0

I have two angular projects in my VPS, the main project is found at /home/first_app/, the second one is at /home/second_app/

This is my nginx conf:

server_name www.my_domain.com my_domain.com location /second_app { alias /home/second_app/dist; try_files $uri $uri/ /index.html =404; } location / { root /home/first_app/dist; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } 

The first app works well but I cannot access to the second app by using: mydomain.com/second_app. It always took the / location block.

In the debug log, I found:

test location "/" test location "second_app" use configuration "/" 

Thanks !

1
  • Can you try to move first location section (location /second_app) to second position? Commented Dec 26, 2017 at 16:04

1 Answer 1

-1

First of all plz create a dist build.

Using Angular CLI.

$ng build --prod

after that try using a local server on your dist/ folder. you cant install nws.

npm install -g nws

and run

nws

and go to this url. http://localhost:3030

if you see your apps running fine you can discard its. after that maybe you can follow this solution.

Well, i hope this can be handy.

Sign up to request clarification or add additional context in comments.

1 Comment

This by no means resolves the issue in question, the resolution or answer should be related to a proper configuration in nginx not using a build server or proxy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.