我想主办一个Wordpress站点http://example.com/content
。Nginx重定向一个路径(wordpress)
我的主站是example.com上的Meteor站点,前面有nginx。
这是我的nginx配置文件,但http://example.com/content
刚刚被重定向到https://example.com/content
,并完全忽略了/content
位置块。任何想法如何解决这个问题?
# HTTP
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html; # root is irrelevant
index index.html index.htm; # this is also irrelevant
server_name example.com;
location /content/ {
proxy_pass http://123.123.123.123; #wordpress ip
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# redirect non-SSL to SSL
location/{
rewrite ^https://$server_name$request_uri? permanent;
}
}
你的位置块是'/ content /'而不是'/ content',正如问题所暗示的那样。另外,您的安全网站是否使用HSTS标头? –
我用/ content试过它,它也没有工作。真的是我想要它的内容/ *去wp网站上的/ * –
我不知道什么是hsts。主站点使用https,而wp不支持 –