Insert text into nginx.conf to partially anonymize IP logs

AI-generated summary

DMTryptamines wants to insert text at the end of the nginx.conf file to partially anonymize IP logs. They are having trouble understanding how to use hooks in app.yml to achieve this and are seeking documentation or examples. pfaffman suggests reviewing the web.template.yml file for examples of modifying the nginx config and recommends testing changes inside the container before rebuilding.

Essentially I want to modify nginx.conf to insert text at the end of the file from the below link:

I understand I need to do this with a hook in app.yml but I’m having a hard time understanding exactly how this works. More importantly trying to Google this hasn’t resulted in any documentation on how to use the replace command or useful posts at all, I suspect I’m using the wrong terminology.

I did find the following post by someone attempting to do the same thing but the examples in the repo only leave me feeling more confused.

Anyone know what I need to do here or where I can find documentation on doing it?

Have a look at discourse_docker/templates/web.template.yml at main · discourse/discourse_docker · GitHub for some examples of modifying the nginx config.

What I usually do is modify the config files by hand inside the container to test before making changes to the yml, as it takes a long time to rebuild to see if your changes worked.