Nginx配置

2021/12/21 中间件 共 388 字,约 2 分钟

前端静态页

  server {
        listen       8910; //监听某个端口,80或其他(其他端口访问需要带上端口)
        server_name  twx.qq.cn; //服务名,域名或IP

        location / { //可以设置路径
            root   /service/local/html/company/; //设置根目录
            index  index.html index.htm; //首页
            try_files  $uri $uri/ /index.html; //刷新URI

        }
    }                                                  

服务端

server {
        listen       8911; //监听端口,80或其他(访问带端口)
        server_name  twx.qq.cn;

        location /hsgz { //根据path定位具体服务
            proxy_pass   http://pl-weixin;
        }
    }
    upstream pl-weixin {
        server localhost:8911; //服务IP和端口,可以设置多个,负载均衡
    }                                 

文档信息

搜索

    Table of Contents