Reputation: 35928
I have an angularjs one application in a dist
folder. I would like to host it on my nginx. My nginx currently hosts multiple applications via proxy_pass
. I've never hosted a static html app on nginx so I'm not sure what to do.
dist
folder on the nginx server at location /home/anthony/dist
. ssl_proxy
in sites-enabled
foldersites-available
I have a locations
folder that contains various .conf
files. I've created a new file at /etc/nginx/sites-available/locations/mystatic.conf
and placed the following content in it:
location /mystatic {
try_files $uri $uri/ /home/anthony/dist/index.html;
}
But after restarting nginx and going to http://<myserver>/mystatic
I get a 404.
Upvotes: 0
Views: 61
Reputation: 1107
Try:
location /mystatic {
index index.html;
alias /home/anthony/dist;
}
Upvotes: 1