location ~ \.php$ { #允许跨域访问 #add_header 'Access-Control-Allow-Origin' '*'; #不限域名 add_header 'Access-Control-Allow-Origin' 'http://dev.gongfuxiang.com'; #限制域名的方式 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'; #PHP配置 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }