50 lines
1.5 KiB
Nginx Configuration File
50 lines
1.5 KiB
Nginx Configuration File
events {
|
||
worker_connections 1024;
|
||
}
|
||
|
||
http {
|
||
upstream app {
|
||
server usdt-shop:3000;
|
||
}
|
||
|
||
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
# 重定向HTTP到HTTPS(可选)
|
||
# return 301 https://$server_name$request_uri;
|
||
|
||
location / {
|
||
proxy_pass http://app;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection 'upgrade';
|
||
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;
|
||
proxy_cache_bypass $http_upgrade;
|
||
}
|
||
}
|
||
|
||
# HTTPS配置(需要SSL证书)
|
||
# server {
|
||
# listen 443 ssl;
|
||
# server_name your-domain.com;
|
||
#
|
||
# ssl_certificate /etc/nginx/ssl/cert.pem;
|
||
# ssl_certificate_key /etc/nginx/ssl/key.pem;
|
||
#
|
||
# location / {
|
||
# proxy_pass http://app;
|
||
# proxy_http_version 1.1;
|
||
# proxy_set_header Upgrade $http_upgrade;
|
||
# proxy_set_header Connection 'upgrade';
|
||
# 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;
|
||
# proxy_cache_bypass $http_upgrade;
|
||
# }
|
||
# }
|
||
} |