Cha*_*ngh 3 nginx winginx nginx-location
我想将我们的系统端口 82 映射到 127.0.0.1:8080/runningSite 并且我遇到了 nginx 配置异常。
upstream dev {
server 127.0.0.1:8080/runningSite;
}
server {
rewrite_log on;
listen [::]:81;
server_name localhost;
location / {
proxy_pass http://dev;
proxy_set_header Host $http_host;
}
}
Run Code Online (Sandbox Code Playgroud)
例外 :
nginx: [emerg] invalid host in upstream "127.0.0.1:8080/runningSite" in C:\nginx -1.8.1/conf/nginx.conf:85
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我哪里我错了。
您的 URI 位于错误的位置。它需要进入proxy_pass而不是在upstream块中。
尝试这个:
upstream dev {
server 127.0.0.1:8080;
}
server {
rewrite_log on;
listen [::]:81;
server_name localhost;
location / {
proxy_pass http://dev/runningSite/;
proxy_set_header Host $http_host;
}
}
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅此文档。
| 归档时间: |
|
| 查看次数: |
8319 次 |
| 最近记录: |