前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >最详细nginx反向代理之端口配置

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

作者头像
马克社区
发布2022-08-09 15:29:51
1.3K0
发布2022-08-09 15:29:51
举报
文章被收录于专栏:高端IT高端IT

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;

代码语言:javascript
复制
   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 {
    }
    }
1234567891011121314151617181920212223242526

更多请见:https://blog.csdn.net/weixin_44519496/article/details/120182160

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云服务器
云服务器(Cloud Virtual Machine,CVM)提供安全可靠的弹性计算服务。 您可以实时扩展或缩减计算资源,适应变化的业务需求,并只需按实际使用的资源计费。使用 CVM 可以极大降低您的软硬件采购成本,简化 IT 运维工作。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档