Wordpress Nginx:config在升级后无效
我将WordPress迁移到一个新的vps,并决定将Nginx升级到1.9; 最初的配置是针对Nginx 1.4.6的(Ubuntu存储库中的默认配置) 但我现有的配置停止工作,我找不到问题出在哪里Wordpress Nginx:config在升级后无效,wordpress,nginx,Wordpress,Nginx,我将WordPress迁移到一个新的vps,并决定将Nginx升级到1.9; 最初的配置是针对Nginx 1.4.6的(Ubuntu存储库中的默认配置) 但我现有的配置停止工作,我找不到问题出在哪里 server { listen 80; server_name www.example.com; rewrite ^/(.*)$ https://example.com/$1 permanent; } server { listen
server {
listen 80;
server_name www.example.com;
rewrite ^/(.*)$ https://example.com/$1 permanent;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/user/www;
index index.php index.html index.htm;
gzip on;
gzip_comp_level 1;
server_name example.com;
if ($http_x_forwarded_proto = "http") {
return 301 https://$server_name$request_uri;
}
location ~ /\. {
deny all;
}
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
升级的想法是在这个网站上使用http2
我使用Ubuntu 14.04和CloudFlare SSL,如下所示:
要解决此问题,我们将使用以下命令打开NGINX.conf文件
vi/etc/nginx/nginx.conf
在NGIX中打开文件默认站点,以修复WordPress
中的空白屏幕错误 vi/etc/nginx/sites enabled/default你检查过nginx错误日志文件吗?日志中没有任何内容,但我看到的不是网站,而是空白页面
#######Add below line
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
######disable below limit_zone & limit_cone parameters
##limit_zone slimits $binary_remote_addr 5m;
##limit_conn slimits 5;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock; ##if you're using php5-fpm
fastcgi_index index.php;
include fastcgi_params;
##Add below line to fix the blank screen error
include fastcgi.conf;
}
root@www:~# /etc/init.d/nginx restart
* Restarting nginx nginx
...done.