I am trying to dockerize my angular app. When I go to the web page, everything works fine until I refresh the page (F5). When I used nginx:1.17.1-alpine as the base image, I fixed the problem by using the following nginx.conf file instead of the nginx.conf default file:
server {
listen 4200;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}}
My dockerfile looked like that:
FROM nginx:1.17.1-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY /dist/frontend /usr/share/nginx/html
EXPOSE 4200
However now I need to use bitnami/nginx:1.21.6-debian-10-r88 as my base image. When I try to build the container, I get the following error:
RUN rm /etc/nginx/conf.d/default.conf:
#15 0.399 rm: cannot remove '/etc/nginx/conf.d/default.conf': No such
file or directory
Anyone can help me figure out how to build the container properly?
CodePudding user response:
The nginx config is located in /opt/bitnami/nginx/conf
As described in the Readme at Step 1
you can copy your server-block config to
/opt/bitnami/nginx/conf/server_blocks/my_server_block.conf