我很精彩。也许有人可以找到为什么这不起作用。
使用Nginx 1.10.0并尝试在我的实验服务器ubuntu 16.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 / sites-available / default
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;
}
}
在我的/etc/php/7.0/fpm/pool.d/www.conf
中listen = /var/run/php7-fpm.sock;
...
套接字存在于相应的目录中。
我试过了:
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中没什么异常
文件仍在下载而不是执行。我错过了什么?
答案 0 :(得分:0)
好的,这太傻了!!!!希望这不会发生在任何其他人身上!我一直在配置错误的nginx文件!!!!
我通过输入nginx -V(大写V)得到了...它会为你的所有nginx文件提供正确的路径...请不要假设你正在处理的文件是正确的一个!
解决!