Nginx add reverse proxy

I’m using Hestia v1.8.2 on my Ubuntu 22.04 server.
I’m having problems with Nginx, and setting up a reverse proxy for a docker container.

location /api/ {

This code works perfectly if I place it in the ‘Default Web Domain Template’, and of course like the warning says it gets overwritten on all rebuilds.

I cannot figure out where to place it so it wont be overwritten.

The Hestia documentations seems to be written for experts only, and it has very few details and no samples to follow. And after a long google search I am nowhere near to figure out where this code belongs, or how to create a special template for it. Could someone please point me in the right direction, preferably with some details :slight_smile:

Create a custom template.

Thanks, but unfortunately this documentation isn’t detailed enough for beginners.

then you maybe need to get some help, probaly a sysadmin could do the job.

I finally managed to understand the hestia documentation with a lot of trial and error and fix my issue. It’s like this documentation is written in machine code with many lines missing :face_exhaling: making it so hard to understand.

And because the forum just pastes this same link to everyone asking this same question, I thought I might put a solution here in plane English. I don’t know if it’s the best solution, but at least it works, and still works after rebuilds.

To add a reverse proxy to the hestia-nginx setup, you need to go to “/usr/local/hestia/data/templates/web/nginx” on your server and make a copy of both default.tpl and default.stpl and rename to something you can recognize, for example to new.tpl and new.stpl and let the new files stay in the same path they were copied from “/usr/local/hestia/data/templates/web/nginx” - If you face ‘permission denied’ on this operation, it can be fixed by setting permission for the folder like this:

sudo chmod -R 777 /usr/local/hestia/data/templates/web/nginx/

Then add you’r changes to the new files. -tpl file seems to be for http and stpl for https.
For my needs I added this code in the new.stpl file:
(It forwards a secure https call to ‘http:/mydomain/api/’ to a non secure http container on my server.)

location /api/ {
    proxy_pass      http://%ip%:5291

Then to enable the changes, you go to your hestia control panel. Logged in with the user that created the domian in the first place. And in the WEB tab choosing the “pencil” behind the domain name. That takes you to the “Edit web domain” there are advanced settings at the bottom of that page that allow you to choose your new template. After pressing ‘save’ your’e changes should be active.


Try not to change permissions to: anyone can do anything they want with the templates folder.

1 Like