我尝试将博客从一台服务器上的 apache 迁移到另一台服务器上的 nginx。
首页和文章都很好(使用永久链接)。wp-login.php 很好。但是 /wp-admin 只输出部分 html,在该部分的某处停止
这是我的 nginx 配置:
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80; ## listen for ipv6
root /home/someblog/www;
index index.php index.html index.htm;
#this isn't really example.com ;)
server_name example.com;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
# I tried commenting this as well
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# 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:/tmp/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}