搭建的vscode 服務使用nginx代理後不能訪問
阿新 • • 發佈:2020-09-12
我的服務搭建完成後就只能進入密碼驗證介面,密碼驗證完成後就沒有然後了
出現這個問題我首先想到的是nginx 的配置問題,驗證了一下,如果不適用nginx代理訪問就沒有問題,說明我的猜想是正確的.
在網上搜索,檢視到別人的配置和我的不一樣:
參考配置:
#user nobody; worker_processes 2; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; client_max_body_size 200m; #gzip on; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream websocket { server localhost:8443; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } } }
我一般配置nginx 沒有配置這幾行,也不知道是幹啥的.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";