Nginx重定向到额外子目录

时间:2015-10-09 作者:Colin

我有一个安装了VVV的本地站点,我将其安装在一个子目录中,以尝试和模拟生产环境。

http://localtest.dev/m/

页面按预期工作

http://localtest.dev/m/some-page/

但对wp admin的请求重定向到路径中包含额外目录的URL

http://localtest.dev/m/wp-admin -> http://localtest.dev/m/m/wp-admin/

我的本地测试。配置如下:

server {
# Determines the port number that nginx will listen to for this
# server configuration. 80 is the default http port.
listen       80;

# Listen for HTTPS requests as well
listen       443 ssl;

# Tells nginx what domain name should trigger this configuration. If
# you would like multiple domains or subdomains, they can be space
# delimited here. See http://nginx.org/en/docs/http/server_names.html
server_name  localtest.dev ~^localtest\\.\\d+\\.\\d+\\.\\d+\\.\\d+\\.xip\\.io$;

# Tells nginx which directory the files for this domain are located
root         /srv/www/localtest/htdocs;
index       index.php;
# Subdirectory location settings

location /m/ {
    try_files $uri $uri/ /m/index.php?$args;
}

# Includes a basic WordPress configuration to help with the common
# rules needed by a web server to deal with WordPress properly.
include /etc/nginx/nginx-wp-common.conf;
}
如有任何建议,将不胜感激。

1 个回复
SO网友:Jeff Mattson

从“/m/index”中删除“/m”。php$args;\'

相关推荐

Docker化的Wordpress出现了Nginx代理问题

我有一个停靠的Nginx代理,它位于我的服务器上。我的一个网站是Docker Compose Wordpress网站。它们是单独的容器,必须保持这种状态。When I update my Site Url in the Settings I can still log into my Admin Dashboard, but I cannot reach my actual site. I receive a 502 Gateway Error from Nginx. Nginx服务器块: serv