I have an angular 4 SPA app and I\'am using docker for production. Looks fine so far. Via terminal I go to /dist
folder and from there I let docker point to the con
The issue is that in the default nginx config it only uses the index
directive. What you need is the try_files directive which will first try the uri
then it will go to the index.html
To do this you need to pass in your own default virtual host config. Something like the following should work. This is based on Nginx's Docker Github
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri /index.html;
}
}
After that is it should be just making that file as a volume in the right spot.
docker run -d -p 9090:80 -v $(pwd):/usr/share/nginx/html -v (path_to_your_config):/etc/nginx/conf.d/default.conf nginx:alpine