mercredi 21 novembre 2018

nginx cannot find js files under the assets folder

I have a compiled Angular application located on my local disk. Trying to run it on nginx server. Added the following configuration:

server{
   listen 8080;

.......

       location /myapp/ {
            root C:/myapp/;
            try_files $uri$args $uri$args/ =404;
       }

index.html file in project root contains references to js files, located in myapp/assets/js folder:

<script src="/assets/js/myscript.js"></script>

But when I run it on server, I get index.html file, it opens, it tries to locate file in http://127.0.0.1:8080/assets/js/polyfill.min.js, avoiding root "myapp", which leads to 404 error.

Adding additional location "location /assets/" doesn't solve the problem. Could anyone help me with this?

Thanks.




Aucun commentaire:

Enregistrer un commentaire