Proxy (nginx) setup to have

Hi - I found the following instructions:


but this is to set it up in port 80 or 443 using
I have a domain and use directories for my apps something like:

For example in this case I have leantime running in port 8081.
Anybody knows how to adapt the nginx.conf from github to handle this configuration?

Hi @cesalo!

From what I could gather from the NGINX config, it should be something like this if you want, and NGINX will be listening just on port 80:

server {
	listen 80;
	set $base /var/www/leantime;
	root $base/public;
	access_log /var/log/nginx/lpm.access.log;
	error_log /var/log/nginx/lpm.error.log warn;
	index index.php;
	location ~.php$ {
		try_files $fastcgi_script_name =404;
		include fastcgi_params;
		fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
		fastcgi_index index.php;
		fastcgi_buffers 8 16k;
		fastcgi_buffer_size 32k;
		fastcgi_param DOCUMENT_ROOT $realpath_root;
		fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";

	location /leantime {
		rewrite ^/?$ /index.php?;
		rewrite ^/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2;
		rewrite ^/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3;

	location = /leantime/resetPassword {
	rewrite ^(.*)$ /index.php?resetPassword=true;

	location /leantime/resetPassword {
		rewrite ^/resetPassword/([^/\.]+)/?$ /index.php?resetPassword=true&hash=$1;

	location = /leantime/install {
		rewrite ^(.*)$ /index.php?install=true;

	location /leantime/install {
		rewrite ^/install/([^/\.]+)/?$ /index.php?install=true;

	location = /leantime/update {
		rewrite ^(.*)$ /index.php?update=true;

	location /leantime/update {
		rewrite ^/update/([^/\.]+)/?$ /index.php?update=true;

	location = /leantime/favicon.ico {
		log_not_found off;
		access_log off;

	location = /leantime/robots.txt {
		log_not_found off;
		access_log off;

	location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
		expires 7d;
		access_log off;

	location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
		add_header Access-Control-Allow-Origin "*";
		expires 7d;
		access_log off;

	gzip on;
	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

If you would like to have leantime running on port 8080, you just need to edit the following:
listen 8080;
From the previous comment and then the URL should be

Thank you @mauriciolazo. You are exactly right. This config is the one you’d want to use.

What’s the procedure to get it to work under the subpath if one is using the docker images of leantime with nginx as a reverse proxy? I didn’t found a parameter to set the webroot. Any ideas?