我在本地计算机上运行django,并想将nginx请求重定向到我的本地ip到django url。但是由于某种原因,什么都没用。
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# Enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
location /category {
proxy_pass http://localhost:3000/tests/category;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# Enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
但是由于某种原因,我不断收到404。我的目标是让我的服务器IP为1.1.1.1,并将我的dns映射为http://www.etc.com
因此,当我输入http://www.etc.com/时,它应该路由到django localhost:3000 / 当我输入http://www.etc.com/category时,它应该路由到django l ocalhost:3000 /测试/类别
我该怎么做?我错过了什么?我真的很困惑