Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I modify nginx configuration in a persistent way? #4

Open
marcinbudny opened this issue Apr 14, 2016 · 2 comments
Open

How can I modify nginx configuration in a persistent way? #4

marcinbudny opened this issue Apr 14, 2016 · 2 comments

Comments

@marcinbudny
Copy link

I would like to make following changes to nginx configuration:

  • modify gzip settings
  • add http -> https redirect

What is the recommended way to do this? Right now any changes to nginx configuration get overwritten on container restart.

@garywiz
Copy link
Owner

garywiz commented Apr 18, 2016

The only real way to do this is to create a custom, derivative image of your own which has the settings you want. There are two ways to do this:

  1. Simply fork the repo and make changes to the template in etc/nginx.conf.tpl.
  2. Modify build.sh to contain the name of your custom repo (instead of garywiz/docker-grav).

Then, you can use your new repo with any new settings you wish.

I agree it would be nice to have more customization ,but it's hard to anticipate what people may need since there are so many possible areas.

One possibility would be to recognize that nginx.conf had been set to read-only and not overwrite it. Then, you could manually change the permissions to preserve it. Thoughts on that?

@marcinbudny
Copy link
Author

AFAIK the read-only attribute will not be preserved in a git repository. I would like to be able to deploy my site from git to a host directly.
My suggestion is to have an optional nginx.conf.custom file. This file would be detected on container startup. If it exists, it is used instead of default nginx.conf. Its contents could be even copied into nginx.conf if that makes things easier.
Similar functionality is needed also for sites.d/grav.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants