Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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
Nginx和php-fpm下载php文件而不是执行_Php_Wordpress_Nginx_Server_Config - Fatal编程技术网

Nginx和php-fpm下载php文件而不是执行

Nginx和php-fpm下载php文件而不是执行,php,wordpress,nginx,server,config,Php,Wordpress,Nginx,Server,Config,我是一个传奇人物。也许有人能找到这不起作用的原因 使用nginx1.10.0并尝试在我的实验服务器ubuntu16.04上安装带有pagespeed的Worpress /usr/local/nginx/conf/nginx.conf user henri:www-data; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log

我是一个传奇人物。也许有人能找到这不起作用的原因

使用nginx1.10.0并尝试在我的实验服务器ubuntu16.04上安装带有pagespeed的Worpress

/usr/local/nginx/conf/nginx.conf

user  henri:www-data;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       mime.types;

#    default_type  application/octet-stream;
     default_type text/html;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

}
nano/etc/nginx/可用站点/默认

server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

        root /var/www/www.xxxxxxx.com/public_html;
        index index.php index.html index.htm;

#       server_name localhost;

        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
        }

        location / {
                 try_files $uri $uri/ /index.php$is_args$args;
        }

 location ~ \.php$ {

        fastcgi_pass unix:/var/run/php7-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     }
}
在my/etc/php/7.0/fpm/pool.d/www.conf中

listen = /var/run/php7-fpm.sock;
...
套接字位于相应的目录中

我试过:

  • 清空浏览器缓存
  • 重新启动服务器/nginx/php fpm
  • ps aux | grep php fpm

    root      4593  0.0  0.7 362588 30592 ?        Ss   22:50   0:00 php-fpm: master process (/etc/php/7.0/fpm/php-fp.conf)
    henri     4595  0.0  0.1 362588  6124 ?        S    22:50   0:00 php-fpm: pool www
    henri     4596  0.0  0.1 362588  6124 ?        S    22:50   0:00 php-fpm: pool www
    henri     4769  0.0  0.0  14224   968 pts/0    R+   23:15   0:00 grep --color=auto php-fpm
    
    我的php7.0-fpm.log/Nginx error.log/access.log中没有异常


    文件仍在下载,而不是执行。我错过了什么?

    好吧,那太愚蠢了!!!!希望这不会发生在其他任何人身上!我一直在配置错误的nginx文件

    我是通过输入nginx-V(大写V)得到的。。。它将为您提供所有nginx文件的正确路径。。。请不要认为你正在处理的文件是正确的

    解决了