Nginx一个Server部署二级网站

一、正常部署一个网站

server {
        # IPv4
        listen  80;
        listen [::]:80;
        charset utf-8;     
   
# 接入日志存储位置
        access_log /data/log/nginx/scm/access.log;
#错误日志存储位置
        error_log /data/log/nginx/scm/error.log;

        set $mobile_rewrite do_not_perform;
 

   # WEB前端
        location / {
                # 正常网站部署
                root   /data/scm/web;
                # 保障地址最后写不写/都能访问到首页
                try_files $uri  /index.html;
                index index.html index.htm;
        }
        #h5端配置 二级网站 在打包的时候尽量些一个二级目录,不过好像不弄也行
        location /h5 {//这个地方最后不要添加斜杠
                # 默认PC端访问,这个地方一定要用 alias,用root是不行的
                alias  /data/scm/h5;    
                # 这个地方一定要添加/h5这个二级目录或者是
                try_files $uri /h5/index.html;
                
                index index.html index.htm;
        }

         # 后端接口
        location /prod-api/ {
                proxy_pass http://127.0.0.1:8089/;

        }
}

参考:https://www.cnblogs.com/Fooo/p/18282869

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值