Created
March 15, 2017 09:33
-
-
Save Maras0830/dc6f627eba005bdfc6b741f7f2ea3178 to your computer and use it in GitHub Desktop.
[nginx] same domain map to different project. [Vuex(vue-route) + Laravel]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
I tried this but it will download the file instead of executing it. I also heard that alias does not play well with try_files not sure if that is the problem in my case?