设置网站允许跨域访问

发布时间 2023-12-06 15:23:33作者: 哆啦啊梦

环境PHP+小皮面板(apache):

1、在httpd.conf,取消注释:LoadModule headers_module modules/mod_headers.so

2、修改需要被访问网站的vhosts.conf:

  

<Directory "*">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from XX.XX.XX.XX:XX      //设置允许访问的服务器IP和端口
      Require all granted
      DirectoryIndex index.php index.html error/index.html
            
  </Directory>