Template for NGINX reverse proxy for Docker app

Hello, I have a docker app running on ip:port, I want to make it run in a public domain http://domain.com
I understand that this is through creating .stpl and .tpl templates for Nginx, but I’m not that much familiar with Nginx and so I am not sure what to write here.
Right now my .tpl is looking like this:


#=======================================================================#
# Default Web Domain Template                                           #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
#=======================================================================#

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;

    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
    location / {
        proxy_pass      http://%ip%:8090;
    }
}


and my .stpl is looking like this

#=======================================================================#
# Default Web Domain Template                                           #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
#=======================================================================#

server {
    listen      %ip%:%proxy_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;

    location / {
        proxy_pass      https://%ip%:8090;                                     
    }
}

The domain gives this error 502 bad gateway. nginx.
Does anyone know what I’m doing wrong here?
Thanks

Edit: Actually the http:// version is working. only the https:// is not.

Then your docker app doesn’t support https so use http://%ip%:8090 instead

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.