解决apache静态资源跨域访问

        1)在httpd.conf文件,找到#LoadModule headers_module modules/mod_headers.so,把#去掉

        2)在vhosts.conf文件,找到域名配置,新增 Header set Access-Control-Allow-Origin *  ,如下

         

<VirtualHost *:8081>
    DocumentRoot "D:wwwXXXX"
    ServerName www.test.cn
    ServerAlias 
    Header set Access-Control-Allow-Origin *
  <Directory "D:wwwXXXX">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
     Require all granted
  </Directory>
</VirtualHost>

重启apache