Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
nginxajax-php404错误_Php_Ajax_Nginx - Fatal编程技术网

nginxajax-php404错误

nginxajax-php404错误,php,ajax,nginx,Php,Ajax,Nginx,我已经编写了一个简单的AJAX函数,它可以与PHP web服务进行通信。它在本地(IIS+PHP)中运行良好,但在生产环境中,对PHP文件的AJAX调用会抛出一个404错误(未找到) 这似乎是NGNX配置问题,因此粘贴相关的NGNX配置 server { listen 80 default_server; listen [::]:80 default_server; server_name _; root

我已经编写了一个简单的AJAX函数,它可以与PHP web服务进行通信。它在本地(IIS+PHP)中运行良好,但在生产环境中,对PHP文件的AJAX调用会抛出一个404错误(未找到)

这似乎是NGNX配置问题,因此粘贴相关的NGNX配置

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }   

请建议解决方法。

的可能重复项无法解决错误。找不到相同的404您确定调用的文件(例如)
http://www.example.com/ajax-target.php
作为
ajax target.php
存在于
/usr/share/nginx/html/
中?是。它可以通过浏览器访问,但无法从AJAX访问。的可能副本未解决此错误。找不到相同的404您确定调用的文件(例如)
http://www.example.com/ajax-target.php
作为
ajax target.php
存在于
/usr/share/nginx/html/
中?是。它可以通过浏览器访问,但不能通过ajax访问