我想主辦一個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不支持 –