04: nginx部署vue

1.1 基本配置

server {
        listen 9000;
        server_name 1.1.1.3;
        #access_log logs/access_example.log  main;
        root /home/work/project/frontopwf/dist;
        location / {
                try_files $uri $uri/ @router;
        }
        location @router {
                rewrite ^.*$ /index.html last;
        }
}

 #前后端分离nginx配置

        server {
                        listen 9000;
                        server_name www.example.cn;
                        access_log  /home/work/logs/vue_access.log main;
                        root /home/work/project/frontopwf/dist;
                        location / {
                                        try_files $uri $uri/ @router;
                        }
                        location @router {
                                        rewrite ^.*$ /index.html last;
                        }
        }


        server {
            listen       8000;
            server_name  www.example.cn;
            access_log  /home/work/logs/workorder_access.log main;
            location / {
                proxy_pass http://127.0.0.1:8001;
            }
        }

 

posted @ 2018-11-05 16:16  不做大哥好多年  阅读(724)  评论(2编辑  收藏  举报