Page 1 of 1

Proxy webapps nginx

Posted: Wed Nov 27, 2019 4:00 pm
by AlojzMustafa

I am running DietPi with Nextcloud. Nextcloud is available as ip_adress/nextcloud.

Also I would like to use Portrainer in Docker (as image). How could I set up Portrainer available as ip_address/portrainer instead of ip_address:9000.

Using nginx as webserver.

Could someone help me?

BTW: Thank you for great work.

Re: Proxy webapps nginx

Posted: Fri Nov 29, 2019 5:41 pm
by MichaIng
Check out: ... rse-proxy/
You could use our drop-in directory to apply this as a separate config file which can then be easily adjusted/removed independantly.

Code: Select all

cat << _EOF_ > /etc/nginx/sites-dietpi/portrainer.conf
location ^~ /portainer {
	proxy_pass http://localhost:9000;
systemctl reload nginx
The ^~ in location directive btw means that Nginx shall stop searching for other matching location directives, which is in most cases useful when having web application specific locations and some more generic locations later on (something like .*\.php to apply directives to PHP files, which would be covered in this case Docker-internally already.)

If you want to use HTTPS, assure that /etc/nginx/sites-dietpi is included from the 443/HTTPS vhost (default when enabled via dietpi-letsencrypt) and then adjust the above to proxy to https://...
There is also a proxy_redirect redective, which can be used to proxy from http to https, if your other website(s) should be accessible via HTTP, but portainer via HTTPS: ... y_redirect