Ngnix config is not retained after rebuild

AI-generated summary

A user (11122) is facing an issue where their modified Nginx config is not retained after a rebuild. Martyn suggested creating a template for the alterations and including it in the app.yml file.

The user (11122) expressed uncertainty about the template file format and requested clarification on a specific line of code. gerhard pointed them to the Pups documentation.

When asked about the differences between etc/nginx/conf.d/discourse.conf and etc/nginx/nginx.conf, the user (11122) did not receive a direct answer. Instead, eviltrout inquired about the purpose of the modification, suggesting there might be an alternative solution.

The user (11122) explained that they use AWS CloudFront as their CDN, which grabs files with HTTP 1.0, preventing gzip compression. They want to modify the Nginx configuration from HTTP 1.1 to HTTP 1.0 to resolve this issue.

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?

You could make a template for your alterations and then include it in your app.yml. For example this SSL template rewrites some parts of the nginx config to support SSL.

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?

Take a look at the documentation of pups: GitHub - discourse/pups: Simple yaml based bootstrapper for Linux machines · GitHub

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

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

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