【发布时间】:2017-07-23 06:29:50
【问题描述】:
我想了解 Nginx 配置文件、域和 Wordpress 站点 URL 之间的联系。
我将我的域 blog.example.com 映射到我的 ip:xxx.xxx.xxx.xxx/wordpress/ 在 Wordpress SiteUrl 我设置 blog.example.com
我的 NGINX 配置文件应该是什么样子的?
编辑
我的配置在第一步工作,我进入首页,但是当点击永久链接时,我再次被重定向到首页而不是帖子。
我当前的配置如下所示:
server {
listen 80 default_server;
root /var/www/wordpress/;
index index.html index.htm index.php
server_name blog.example.com;
location ~\.php$ {
try_files $uri =404;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param REQUEST_URI $uri?$args;
}
location / {
try_files $uri /index.php$args;
}
}
编辑
在 Nginx 调试日志中,我看到 REQUEST_URI 是 /wordpress/postname/ 但据我了解,它应该只是 /postname/
【问题讨论】: