Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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
404使用nginx的任何php文件出现错误_Php_Nginx - Fatal编程技术网

404使用nginx的任何php文件出现错误

404使用nginx的任何php文件出现错误,php,nginx,Php,Nginx,我意识到这个问题已经被问了很多次,但尽管我尝试了各种各样的解决方案,许多人建议我仍然没有解决我的问题: 无论我做什么,我网站上的任何php文件都会给我一个404错误。然而,html文件工作得很好 my nginx.conf: user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http {

我意识到这个问题已经被问了很多次,但尽管我尝试了各种各样的解决方案,许多人建议我仍然没有解决我的问题:

无论我做什么,我网站上的任何php文件都会给我一个404错误。然而,html文件工作得很好

my nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POOD$
        ssl_prefer_server_ciphers on;

        access_log /home/****/websites/logs/access.log;
        error_log /home/****/websites/logs/error.log;

        include v-hosts/*.conf;
        #### prevent processing requests with undefined server names
        server  {
                listen 80;
                server_name '';
                return 444;
        }


}
my/etc/nginx/v-hosts/website.com.conf

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/*****/websites/website.com/root;
    index index.php index.html index.htm;

    server_name website.com www.website.com;

    location / {
        try_files $uri $uri/ =404;
        root /home/****/websites/website.com/root;
        index index.php index.html index.html;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /home/****/websites/website.com/root;
    }

    location ~ \.php$ {
        root /home/****/websites/website.com/root;
        try_files $uri =404;

        fastcgi_pass unix:/run/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        }
}
  • 我在php.ini中设置了
    cgi.fix\u pathinfo=0
  • 我在/home/**/websites/website.com/root中有index.php和info.php

谢谢

我已成功解决了我的问题!在访问/home/**/websites/logs/error.log中的错误日志后,我实现了我的路径
fastcgi\u pass unix:/run/php7.0-fpm.sock是错误的。我已将其更改为
fastcgi\u pass unix:/run/php/php7.0-fpm.sock和页面现在显示正确

`