首页 > Web > nginx > 正文

nginx跨域解决方案
2020-08-04 09:34:12 点击:

实例如下,请根据情况调整:server { listen 80 ; server_name api xxx com; index index html index php; root www admin publi
实例如下,请根据情况调整:

server
    {  
        listen 80 ;
        server_name api.xxx.com;
        index index.html index.php;
        root  /www/admin/public;     
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
        add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

   location / {
               if ($request_method = 'OPTIONS') { return 204; }             

   }
   include enable-php.conf;
   }




附件:

https://www.cnop.net/uploadfile/2020/0804/20200804094139673.zip


相关热词搜索:

上一篇:nginx 重启报错 [error] invalid PID number /usr/.../nginx.pid
下一篇:nginx cpu核心数优化