跨域请求 Apache 服务器配置

来源:互联网 发布:免流服务器ip改域名 编辑:程序博客网 时间:2024/05/22 13:51

1.修改服务器配置文件

<Directory /www/web/yuming.com/public_html/>    Options FollowSymLinks    AllowOverride All    Require all granted    Header set Access-Control-Allow-Origin *</Directory>

2.编辑httpd.conf

找下面这行,把#去掉,目的是开启apache头信息自定义模块#LoadModule headers_module modules/mod_headers.so

重点内容

Access-Control-Allow-Origin *意思是对这个域名的资源进行访问时,添加一个头信息

最后重启服务器生效

0 0