Geoblocking using Nginx of the container?

Sorry, this is pure 101 question. But I know how to use Nginx to block problematic countries, aka. geoblocking, and stop unwanted user agents. I could use a reverse proxy front of Discourse, I’ve done that before, but I don’t know anything about containers. Heck, I don’t even understand how docker works in the first place.

So, can I use same Nginx what Discourse uses? Or putting the same on more simplier way: can I do same stuff inside a container that I would/could do outside it? Or would all changes be overwritten when I next time do upgrading?

I’m trying to avoid using extra Nginx as a reverse proxy, because I don’t like questions like is your setup as recommended :joy:

To saving time I started here, not with AI. LLMs has tendency to be 80% accurate, and that missing 20% would be really time consuming…

I know this question won’t be suitable here, but this isn’t defenetly a support question either. Please, feel free to move it somewhere else.

I would create a template that you include in the docker container which is created by the launcher.

For example like this rate limiting template which makes changes to the nginx setup: discourse_docker/templates/web.ratelimited.template.yml at main · discourse/discourse_docker · GitHub

You would include your own template in the templates: list of your container yml configuration.

The next time you rebuild it, your changes to the nginx configuration will be included.

1 Like

After fast googling it looks like I need to use templates, as suggested, and/or a plugin. Otherwise everything will be overwritten.

Or I have to use a reverse proxy outside the container.

Right?

Yes, but if you’re good with nginx, it’s likely not too hard to create a template (or add lines to your app.tml) that does what you want.