最详细nginx反向代理之端口配置

cd /etc/nginx/

vim nginx.conf

 server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  域名;
        listen 443 ssl;
        root         /usr/share/nginx/html;
        ssl_certificate cert/1_www.maomin.club_bundle.crt;
        ssl_certificate_key cert/2_www.maomin.club.key;
        ssl_session_timeout 5m;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

       location / {
                root /root/www/;
                index index.html index.htm;
        }
        location /chat/ {
        proxy_pass http://内网:3001/;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /upload/ {
        proxy_pass http://内网:8083/;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
        }





作者:Vam的金豆之路

主要领域:前端开发

我的微信:maomin9761

微信公众号:前端历劫之路