配置nginx.conf文件php
在nginx.conf裏面,找到server項,並在裏面添加以下配置nginx
location ~ \.php?($|/) { #try_files $uri =404; #handel cosr by mao add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET'; add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type'; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; }
重啓服務器,完成服務器