我有一个安装了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;
}
如有任何建议,将不胜感激。