Answer the question
In order to leave comments, you need to log in
How to implement two vue.js applications on the same nginx domain?
There are two paths:
/home/web/domainname/public/user - User interface
/home/web/domainname/public/admin - Admin panel
And there is nginx configuration
server_name domainname;
location / {
try_files $uri $uri/ /index.html;
alias /home/web/domainname/public/user/;
}
location /admin/ {
try_files $uri $uri/ /index.html;
alias /home/web/domainname/public/admin/;
}
Answer the question
In order to leave comments, you need to log in
server {
server_name domainname;
root /home/web/domainname/public/user;
location / {
try_files $uri $uri/ /index.html;
}
location /admin/ {
root /home/web/domainname/public;
try_files $uri $uri/ /admin/index.html;
}
}
There is no need to duplicate directives and come up with some kind of aliases.
server {
root /home/web/domainname/public;
try_files $uri $uri/ /index.html;
location /user { если захотите как-то по-разному обрабатывать эти пути }
location /admin { }
location / { тут какой-нибудь редирект или что ещё захотите }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question