我已根据说明设置了 Nginx,一切正常,但我的 wp-admin 返回 504 错误(upstream timeout
)。
一切运行正常,所有重写等等。
我尝试过将它缩减回没有缓存等的基本状态...但仍然没有任何效果。
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 82 default_server;
listen [::]:82 default_server ipv6only=on;
root /mnt/wpmount/nen;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
if ($args ~* "^s=(.*)$")
{
return 301 /search/$1;
}
#try_files $uri $uri/ /index.php?q=$uri&$args;
try_files $uri $uri/ /index.php?$args;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* \.(pl|cgi|py|sh|lua)\$ {
return 444;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 60m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
add_header X-Cache $upstream_cache_status;
}
location ~ /\.ht {
deny all;
}
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST)
{
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "")
{
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie = "PHPSESSID")
{
set $no_cache 1;
}
}