[請益] 使用 Nginx 無法正常顯示頁面
請教版上大大,小弟使用Nginx來轉發兩個web service請求,其設定如下
server {
listen 80;
listen 1000;
server_name 192.168.1.150;
return 301 https://for_test.net$request_uri;
}
server {
listen 2000;
server_name 192.168.1.150;
return 301 https://for_test.net/forms$request_uri;
}
server {
listen 443 ssl;
server_name for_test.net;
ssl_certificate /etc/nginx/ssl/certs/for_test.crt;
ssl_certificate_key /etc/nginx/ssl/private/for_test.key;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers
'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000" always;
### A PyWebIO web service ###
location / {
proxy_pass http://127.0.0.1:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Photo $scheme;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
}
### A Streamlit web service ###
location /form {
proxy_pass http://127.0.0.1:4000/;
alias /home/streamlit_app/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Photo $scheme;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
已知連線到http://192.168.1.150時會成功轉到 https://for_test.net
但是連線到http://192.168.1.150/form時,則會顯示Connection error
http://192.168.1.150/form對應的是使用Streamlit製作的web service
其錯誤似乎是找不到檔案 (HTTP 404,非HTTP 301)
請問是否有大大能夠指點迷津?
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 106.1.232.104 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1701181526.A.5AE.html
※ 編輯: qazsd (106.1.232.104 臺灣), 11/28/2023 23:04:46
噓
11/28 23:15,
2年前
, 1F
11/28 23:15, 1F
→
11/29 01:45,
2年前
, 2F
11/29 01:45, 2F
噓
11/29 04:51,
2年前
, 3F
11/29 04:51, 3F
噓
11/29 08:39,
2年前
, 4F
11/29 08:39, 4F
→
11/29 10:21,
2年前
, 5F
11/29 10:21, 5F
→
11/29 10:30,
2年前
, 6F
11/29 10:30, 6F
→
11/29 11:31,
2年前
, 7F
11/29 11:31, 7F

→
11/29 11:31,
2年前
, 8F
11/29 11:31, 8F
噓
11/29 16:14,
2年前
, 9F
11/29 16:14, 9F
→
11/30 00:55,
2年前
, 10F
11/30 00:55, 10F
→
11/30 15:20,
2年前
, 11F
11/30 15:20, 11F
→
11/30 15:21,
2年前
, 12F
11/30 15:21, 12F
→
11/30 15:23,
2年前
, 13F
11/30 15:23, 13F
→
11/30 15:23,
2年前
, 14F
11/30 15:23, 14F
→
12/01 00:48,
2年前
, 15F
12/01 00:48, 15F
→
12/01 00:50,
2年前
, 16F
12/01 00:50, 16F
→
12/01 00:52,
2年前
, 17F
12/01 00:52, 17F
→
12/01 00:53,
2年前
, 18F
12/01 00:53, 18F
→
12/01 00:55,
2年前
, 19F
12/01 00:55, 19F
→
12/01 10:30,
2年前
, 20F
12/01 10:30, 20F
Soft_Job 近期熱門文章
PTT職涯區 即時熱門文章