Reputation: 5922
I installed docker on my linux and I installed nginx container like this:
docker pull nginx
docker run -it -d -p 8081:80 --name web -v /mnt/Project/Flutter/Projects/app_web2/build/web:/usr/share/nginx/html nginx
Now I want to change Cache-Control
on my nginx container. Because I write a pwa with flutter, Every time I changed my page, when I launch page I still see old version of page, Now I want to change nginx caching.
How can I change it's default?
Upvotes: 0
Views: 1647
Reputation: 17485
I suspect that you can achieve this directly. There are two approach.
Run nginx container as you running as of now. Then perform following operation.
docker exec -it <<containername>>
go to /etc/nginx/conf.d/default.conf ( Edit this file)
Note : This approach is problem as you have to do this every time.
Another approach is create custom image based on nginx.
FROM nginx:latest
COPY ./default.conf /etc/nginx/conf.d/default.conf
This ./default.conf will reside in your directory and from where you execute following command.
docker build . mynginx:latest
In this default.conf at your directory you can add custom header.
You can find sample over here : https://github.com/jp1482/mynginxwithcustomerheader
Upvotes: 1