一個域名多個vue項目的nginx配置

狀況1以下:html

http://a/vue1vue

http://a/vue2nginx

配置:code

server {
    listen 80;
    server_name a;
    root /data/wwwroot/a;
    index index.html;

    location / {
        index index.html;
    }
    location ~ /(\w+)/(\w+) {
        try_files $uri $uri/ /$1/index.html;
    }
    access_log /data/logs/nginx/a_access.log;
    error_log /data/logs/nginx/a_error.log;
}

狀況2以下:server

http://a/folder/vue1htm

http://a/folder/vue1io

配置:配置

server {
    listen 80;
    server_name a;
    root /data/wwwroot/a;
    index index.html;

    location / {
        index index.html;
    }
    location ~ /(\w+)/(\w+)/(\w+) {
        try_files $uri $uri/ /$1/$2/index.html;
    }
    access_log /data/logs/nginx/a_access.log;
    error_log /data/logs/nginx/a_error.log;
}
相關文章
相關標籤/搜索