# Ngnix config is not retained after rebuild

**URL:** https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602
**Category:** Self-hosting
**Created:** [16 באוקטובר,‏ 2015,‏ 12:56pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602 "2015-10-16T12:56:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![11122](https://avatars.discourse-cdn.com/v4/letter/1/6a8cbe/32.png) [@11122](https://meta.discourse.org/u/11122)
#### Post date: [16 באוקטובר,‏ 2015,‏ 12:56pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/1 "2015-10-16T12:56:55Z")

</div>

I have to modify the default nginx config. But, after a rebuild, the modifications are not retained. Does anyone have a solution for this?  
And what’s the differents between etc/nginx/conf.d/discourse.conf and etc/nginx/nginx.conf?

---

<div class="post-metadata">

### Author: ![Martyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martyn/32/115601_2.png) [@Martyn](https://meta.discourse.org/u/Martyn)
#### Post date: [16 באוקטובר,‏ 2015,‏ 1:20pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/2 "2015-10-16T13:20:19Z")

</div>

You could make a template for your alterations and then include it in your app.yml. For example [this SSL template](https://github.com/discourse/discourse_docker/blob/master/templates/web.ssl.template.yml) rewrites some parts of the nginx config to support SSL.

---

<div class="post-metadata">

### Author: ![11122](https://avatars.discourse-cdn.com/v4/letter/1/6a8cbe/32.png) [@11122](https://meta.discourse.org/u/11122)
#### Post date: [16 באוקטובר,‏ 2015,‏ 1:31pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/3 "2015-10-16T13:31:06Z")

</div>

Yes, thanks very much. This should work. But I have no idea the format the file. What does “from: /listen 80;\s+gzip on;/m” means?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [16 באוקטובר,‏ 2015,‏ 2:07pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/4 "2015-10-16T14:07:33Z")

</div>

Take a look at the documentation of pups: [GitHub - discourse/pups: Simple yaml based bootstrapper for Linux machines · GitHub](https://github.com/samsaffron/pups)

---

<div class="post-metadata">

### Author: ![11122](https://avatars.discourse-cdn.com/v4/letter/1/6a8cbe/32.png) [@11122](https://meta.discourse.org/u/11122)
#### Post date: [16 באוקטובר,‏ 2015,‏ 2:11pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/5 "2015-10-16T14:11:09Z")

</div>

Thanks, another question: what’s the differents between etc/nginx/conf.d/discourse.conf and etc/nginx/nginx.conf?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [16 באוקטובר,‏ 2015,‏ 2:17pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/6 "2015-10-16T14:17:25Z")

</div>

What are you modifying it to do? I’m asking because there might be another way to achieve the same result.

---

<div class="post-metadata">

### Author: ![11122](https://avatars.discourse-cdn.com/v4/letter/1/6a8cbe/32.png) [@11122](https://meta.discourse.org/u/11122)
#### Post date: [16 באוקטובר,‏ 2015,‏ 2:19pm UTC](https://meta.discourse.org/t/ngnix-config-is-not-retained-after-rebuild/34602/7 "2015-10-16T14:19:48Z")

</div>

Because I use AWS cloud front as the CDN. But it grasps the files with http1.0, it get the original files instead of the gzips because the default http version to get gzip is 1.1. So I want to modified the ngnix configuration from http1,1 to http1.0
