Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
[nginx] same domain map to different project. [Vuex(vue-route) + Laravel]
server {
listen 80;
listen [::]:80;
server_name test.dev;
root /var/www/project1/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# map project2 when url contains project2
location ~ /project2 {
alias /var/www/project2/dist;
try_files $uri $uri/ /index.html last;
}
# map vuejs static folder.
location /static {
alias /var/www/project2/dist/static;
}
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment