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

My default.conf is always deleted when restart #470

Closed
Quentinvarquet opened this issue May 30, 2016 · 8 comments
Closed

My default.conf is always deleted when restart #470

Quentinvarquet opened this issue May 30, 2016 · 8 comments

Comments

@Quentinvarquet
Copy link

Hello,

I am using a custom default.conf file in /etc/nginx/conf.d/default.conf

But every time I restart (docker-compose restart) my default.conf file (volume) is back with the default configuration

Do you know how to fix it ? It's the first time I have this problem.

@wader
Copy link

wader commented May 30, 2016

You have /etc/nginx/conf.d/default.conf on volume and edit it manually? you should probably have a custom nginx.tmpl or put custom things in conf.d etc.
Can you give more information about your setup?

@Quentinvarquet
Copy link
Author

Hello,

My configuration is very simple, here is my docker-compose file :

nginxproxy:
  image: jwilder/nginx-proxy
  ports:
   - "80:80"
   - "443:443"
  volumes:
   - ./nginx-proxy/vhost.d:/etc/nginx/vhost.d
   - ./nginx-proxy/cache:/var/cache/nginx
   - ./nginx-proxy/certs:/etc/nginx/certs
   - /var/run/docker.sock:/tmp/docker.sock
   - ./nginx-proxy/conf.d/default.conf:/etc/nginx/conf.d/default.conf

When I update my default.conf from my server and then I connect in the container : service nginx reload. The configuration is updated and my modification in default.conf works.

But if I restart my container : docker-compose restart. My default.conf is back with the default configuration.

For your information, I am using an old version of your container (june or may 2015, maybe you fixed it in your last version :-) )

@wader
Copy link

wader commented Jun 6, 2016

Ok the thing is that /etc/nginx/conf.d/default.conf is the file docker-gen (see Procfile) will overwritten when it gets events from docker and the configuration has changed.

What kind of changes do you want to make? you can either put custom configuration in /etc/nginx/proxy.conf or /etc/nginx/conf.d/something-not-named-default.conf see https://github.com/jwilder/nginx-proxy#custom-nginx-configuration. There are also ways to have custom configuration per host.

If you want to do something more complicated you can change nginx.tmpl and create your own docker image.

@shubhank008
Copy link

I am having a total opposite problem now (using docker-compose) that my dfeault.conf is not updating. I added SSL companion which didn't work for me (it added lots of stuff in default file which I want to remove).
So when I have removed the companion, deleted the default.conf in my volume and recreating the containers still the new default.conf gets created with all that shit from the SSLcompanion config and not how the nginx_proxy should do by default

@clobber88
Copy link

I'm having the same problem that Quentinvarquet had reported. What I am trying to do is change the default nginx behavior. That is, when I access service1.mydomain.com or service2.mydomain.com everything is working great. However, if I access mybox.mydomain.com I am getting an ugly 503 page returned. I would prefer that the connection just get dropped. It is my understanding that I should be able to change a few lines in default.com. Not sure if it will work, but I read I could just change 503 to 444 below. When I make this change and restart the container, it overwrites back to 503.

Should I be trying this a different way?

server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 80;
access_log /var/log/nginx/access.log vhost;
return 503;
}

@guillaumedsde
Copy link

I think you all need to rename your default.conf file to default

@fcapradev
Copy link

fcapradev commented Aug 24, 2020

Hello, I need to add the following code to my /default.conf, but with volume I cannot edit it, if through the command "cp" once the containers are started:
server {

 location ~ ^ / site / {
    proxy_pass http: // site3;
}
location ~ ^ / site5 / {
    proxy_pass http: // site5;
}

}
In short, I want my nginx_proxy to have the 2 location rules mentioned above

@tkw1536
Copy link
Collaborator

tkw1536 commented Aug 27, 2020

@prgfranco Please have a detailed look at the README. In short, if you want proxy-wide configuration place your code in a separate file, call it something like custom.conf and then put it in the /etc/nginx/conf.d/ directory.

@tkw1536 tkw1536 closed this as completed Apr 10, 2022
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

7 participants