Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/leantime nginx config #330

Closed
etm opened this issue Sep 29, 2020 · 1 comment
Closed

/leantime nginx config #330

etm opened this issue Sep 29, 2020 · 1 comment

Comments

@etm
Copy link

etm commented Sep 29, 2020

Hi,

good job @marcelfolaron. Included you find an example nginx config for installing into a subdirectory. Please note

    rewrite ^/leantime/leantime(/.*)$ /leantime$1 permanent;

which fixes many subdirectory related problems which still persist (most prominent - the non-working To-Dos menu point). Also note the toplevel tickts rewrite, because Filter in To-Dos also has some issues that can be preliminary fixed with the nginx config.
Maybe the nginx config is helpful for somebody.

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

  location /leantime/ {
    include include.d/auth;
    root /var/www/leantime/public/;
    access_log /var/log/nginx/scripts.log scripts;

    rewrite ^/leantime/leantime(/.*)$ /leantime$1 permanent;
    rewrite ^/leantime/?$ /leantime/index.php?act=dashboard.show last;
    rewrite ^/leantime/([^/\.]+)/([^/\.]+)/?$ /leantime/index.php?act=$1.$2 last;
    rewrite ^/leantime/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /leantime/index.php?act=$1.$2&id=$3 last;
    rewrite ^/leantime(/.*)$ $1 break;

    location ~.php$ {
      root /var/www/leantime/public/;

      rewrite ^/leantime(/.*)$ $1 break;

      fastcgi_intercept_errors on;
      fastcgi_index  index.php;
      fastcgi_buffers 8 16k;
      fastcgi_buffer_size 32k;
      include        fastcgi_params;
      fastcgi_param  SCRIPT_FILENAME  /var/www/leantime/public/$fastcgi_script_name;
      fastcgi_param  PATH_INFO $fastcgi_path_info;
      fastcgi_param  DN $ssl_client_s_dn;
      fastcgi_pass   php-fpm;
    }

    location = /leantime/resetPassword {
      rewrite ^(.*)$ /leantime/index.php?resetPassword=true;
    }
    location = /leantime/install {
      rewrite ^(.*)$ /leantime/index.php?install=true;
    }
    location = /leantime/update {
      rewrite ^(.*)$ /leantime/index.php?update=true;
    }
    # assets, media
    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)$ {
      rewrite ^/leantime/leantime(/.*)$ /leantime$1 permanent;
      rewrite ^/leantime(/.*)$ $1 break;
      expires 7d;
      access_log off;
    }
    # svg, fonts
    location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
      rewrite ^/leantime/leantime(/.*)$ /leantime$1 permanent;
      rewrite ^/leantime(/.*)$ $1 break;
      add_header Access-Control-Allow-Origin "*";
      expires 7d;
      access_log off;
    }
    # gzip
    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;
  }
@marcelfolaron
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants