我想使用一个域来映射不同的项目。
mydomain.com.tw =>在/ var / WWW / PROJECT1 /公共
mydomain.com.tw/test => / var / www / project2
但 mydomain.com.tw/project2/detail 始终指向mydomain.com.tw项目路线。
project1 => laravel
project2 => vue并使用vue-route
listen 80;
listen [::]:80;
server_name mydomain.dev;
index index.php index.html index.htm;
root /var/www/project1/public;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /lottery {
alias /var/www/project2/dist;
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
答案 0 :(得分:1)