If you are serving angular app with nginx docker image, you will notice that your cannot directly access your app route Url directly from browser's address bar. You will get 404 file not found error.
To resolve this, you need to edit the default.conf file to tell nginx how to find files.
// Copy your conf.d directory out to your current dir
docker cp columnConcator:/etc/nginx/conf.d .
// Stop the container
docker stop columnConcator
// Edit the default.conf file in conf.d dir
// Update your location block as following:
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
// copy modified directory back
sudo docker cp conf.d/ columnConcator:/etc/nginx
// restart the docker
docker start columnConcator
Done!
Feng
没有评论:
发表评论