nginx vue三级目录配置

server {
        listen 8001;
        location / {
            # vue h5 history mode 时配置
            try_files $uri $uri/ /index.html;
    
            root D:/phpstudy_pro/WWW/Vue/XMTFDMSH/dmsWechat/;
            index index.html index.htm;
        }

    }
    server {
        listen 80;
        server_name  www.dmstest.com;
        location / {
            # vue h5 history mode 时配置
            try_files $uri $uri/ /index.html;
       # 主目录小于子目录一个路径
            root D:/phpstudy_pro/WWW/Vue/XMTFDMSH/;
            index index.html index.htm;
        } 
        location ^~/XMTFDMSH/dmsWechat/ {
          proxy_redirect off;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://127.0.0.1:8001/;
        }
    }
posted @ 2021-04-29 11:31  ˉ八月  阅读(476)  评论(0编辑  收藏  举报