🔍 登录 注册

nginx配置允许跨域访问

大 大苹果 2017-06-05 后端 👁 1521 ⏱ 2min
nginx配置允许跨域访问

nginx配置允许跨域访问

location ~ .*\.(php|php5)?$
{
		
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type, Authorization';
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
    if ($request_method = 'OPTIONS') {return 204;}
    #fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
}


读完了?给作者一点支持

本文采用 CC BY 4.0 协议转载 · © 大苹果

评论(0)

登录 后参与评论。

  • 还没有评论,来抢沙发。

🔗 相关文章