我想将我的wordpress安装从apache迁移到nginx。实际上一切正在发挥作用(至少看起来如此),但重写了网址。
我的设置:
在nginx documentation for wordpress后我尝试添加
location /blog {
try_files $uri $uri/ /wordpress/index.php?$args;
}
location ~ \.php$ {
# ...
fastcgi_split_path_info ^(/blog)(/.*)$;
}
但这仍然不适合我。你有什么想法?
# /etc/nginx/sites-enabled/default
server {
listen 80;
root /var/www/blog;
index index.php;
server_name 12.34.56.789; # server isn't connected with a domain for now
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { allow all; log_not_found off; access_log off; }
location ~ /\. { deny all; }
location ~* /(?:uploads|files)/.*\.php$ { deny all; }
location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(/blog)(/.*)$;
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
也改变了www.conf
# /etc/php5/fpm/pool.d/www.conf
# ...
listen = /var/run/php5-fpm.sock
# ...
php.ini更改了cgi.fix_pathinfo
# /etc/php5/fpm/php.ini
# php.ini
# ...
cgi.fix_pathinfo=0
# ...