0

I use angular-cli to make an angular4 app. I build my app with ng-build and get the dist directory with all my files. I put that files into /var/www/html/my-app directory. Here is my config for nginx :

server {
    listen 80;
    listen [::]:80;
    server_name $hostname;
    root /var/www/html;
    merge_slashes on;

    location /my-app {
        index index.html;
        try_files $uri$args $uri$args/ /index.html;
    }
}

When I try www.my-domain.com/my-app I get well my index but all the scripts file are in 404 not found because they are searched from www.my-domain.com/ and not from www.my-domain.com/my-app/

Is there someone who can help me ?

Thanks

6
  • How do you specify the URI of the scripts? Commented Sep 14, 2017 at 13:25
  • I fix it by building my app with ng build --bh /my-app/ Commented Sep 14, 2017 at 14:22
  • But if I refresh the browser it send me 404 Commented Sep 14, 2017 at 14:32
  • Error in nginx log? Also what url did the browser hit? Commented Sep 14, 2017 at 15:30
  • Does it work now? Commented Sep 26, 2017 at 9:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.