Nginx 配置

远子 •  2020年05月25日

# HTTP
server {
    listen 80;
    server_name zj.rmlzy.com;
    
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

# HTTPS
server {
    listen 443 ssl;
    server_name zj.rmlzy.com;
    ssl_certificate cert/3651634_zj.rmlzy.com.pem;
    ssl_certificate_key cert/3651634_zj.rmlzy.com.key;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        
        proxy_pass http://127.0.0.1:1027;
        proxy_redirect off;
        
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

(完)