多个单页面路由Nginx配置(备忘)

分类:环境配置来源:站内 最近更新:2021-12-06 20:25:17浏览:1086留言:2

sass端项目经常有控制台和管理后台两个系统。分别用单页面做的,如果启动两个端口有些浪费,用目录区分就好

server {
        listen 8081;
        server_name 127.0.0.1;
	client_max_body_size 100M;
        #sass端
        location  / {
            root  /home/chuanglan/yunger/web;
            index index.html;
            try_files $uri $uri/ /index.html;
            if ($request_filename ~* .*\.(?:htm|html)$){
               add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            }
         }

        #管控后台
        location /admin {
            alias /home/chuanglan/yunger/admin;
            try_files $uri $uri/ /admin/index.html;
            if ($request_filename ~* .*\.(?:htm|html)$){
               add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            }
        }


        #admin代理
        location ^~ /boss {
            proxy_pass http://xx.xx.xx.xx:8098;
        }
        #sass控制台接口
        location ^~ /console {
            proxy_pass http://xx.xx.xx.xx:8099;
        }
}


0

发表评论

评论列表(2)

  • 1
    不错
    2021-12-24 13:42:54
    回复 0
  • 管理员
    回复 1的话:"不错"
    感谢,我会继续加油
    2022-07-21 09:42:39
    回复 0
共 2 条留言

热门