在同一LAN服務器nginx上運行多個Web應用程序

我在局域網上提供2個docker容器,在端口5234上提供一個云服務器,在8080上提供一個flask應用程序。

我嘗試使用nginx作為反向代理,在同一個ip上用不同的擴展運行它們。我的配置:

server {
listen 80 default_server;
server_name 192.168.1.23;

location /web {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    access_log /var/log/nginx/flaskapp.access.log;
    error_log /var/log/nginx/flaskapp.error.log;
}

location /cloud {
    proxy_pass http://127.0.0.1:5234;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    access_log /var/log/nginx/nextcloud.access.log;
    error_log /var/log/nginx/nextcloud.error.log;
}

}

但是當訪問192.168.1.23/web或192.168.1.23/cloud時,我得到了一個502壞網關。

In flaskapp.error.log:

connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.72, server: 192.168.1.23, request: "GET /web HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "192.168.1.23"

In nextcloud.error.log:

recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.72, server: 192.168.1.23, request: "GET /cloud HTTP/1.1", upstream: "http://127.0.0.1:5234/cloud", host: "192.168.1.23"

有沒有辦法像這樣在同一個ip上運行多個web應用程序,或者使用不同的端口?

? 最佳回答:

0.0.0.0不是有效的IP地址。試試127.0.0.1,它指向本地主機。這樣地:

proxy_pass http://127.0.0.1:8080;
主站蜘蛛池模板: 国产综合视频在线观看一区| 视频一区在线播放| 在线观看一区二区三区视频| 丰满岳妇乱一区二区三区| 91精品一区二区三区在线观看| 无码AV一区二区三区无码 | 日本精品夜色视频一区二区| 日韩一区精品视频一区二区| 中文字幕人妻丝袜乱一区三区 | 一区二区三区免费精品视频| 国精产品一区一区三区有限公司| 91在线看片一区国产| 无码精品国产一区二区三区免费 | 成人免费av一区二区三区| 日本无卡码免费一区二区三区| 3D动漫精品一区二区三区| 久久精品岛国av一区二区无码| 亚洲无线码在线一区观看| 日本精品一区二区三区在线视频| 日本高清一区二区三区| 国产日韩精品视频一区二区三区| 91在线一区二区| 精品无码一区二区三区电影| 精品国产一区二区三区四区| 日韩人妻一区二区三区免费| 色偷偷av一区二区三区| 亚洲蜜芽在线精品一区| 无码国产精品一区二区免费式直播| 久久久久人妻一区精品性色av| 日韩人妻不卡一区二区三区| 亚洲熟妇av一区二区三区下载| 国产精品夜色一区二区三区| 亚洲AV日韩综合一区尤物| 毛片一区二区三区无码| 最新中文字幕一区| 日本精品一区二区三区在线视频| 中文字幕在线观看一区二区| 亚洲av无码一区二区三区网站| 亚洲一区二区在线免费观看| 一本大道在线无码一区| 日韩AV无码一区二区三区不卡 |