前端静态页
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和端口,可以设置多个,负载均衡
}
文档信息
- 本文作者:yindongxu
- 本文链接:https://iceblow.github.io/2021/12/21/nginx%E9%85%8D%E7%BD%AE/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)