From 764a1cbb69d7319f361ee49b6f6a2bf297daff14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 23 May 2021 16:04:01 -0500 Subject: Fix nginx configuration ``` location ~* ^.+\.(css|png|ico)$ { expires 30d; } ``` ^ that parameter causes that .css files cannot be explored --- gitolite-cgit/entrypoint.sh | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/gitolite-cgit/entrypoint.sh b/gitolite-cgit/entrypoint.sh index dce674e..3bd33c2 100755 --- a/gitolite-cgit/entrypoint.sh +++ b/gitolite-cgit/entrypoint.sh @@ -199,19 +199,34 @@ EOF root /usr/share/webapps/cgit; try_files \$uri @cgit; - location ~* ^.+\.(css|png|ico)$ { - expires 30d; - } + location @cgit { + include fastcgi_params; + + # Path to the CGI script that comes with cgit + fastcgi_param SCRIPT_FILENAME \$document_root/cgit.cgi; - location / { - index cgit.cgi; - fastcgi_param SCRIPT_FILENAME \$document_root/cgit.cgi; - fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.socket; - fastcgi_param HTTP_HOST \$server_name; - fastcgi_param PATH_INFO \$uri; - fastcgi_param QUERY_INFO \$uri; - include "fastcgi_params"; + fastcgi_param PATH_INFO \$uri; + fastcgi_param QUERY_STRING \$args; + fastcgi_param QUERY_INFO \$uri; + fastcgi_param HTTP_HOST \$server_name; + + # Path to the socket file that is created/used by fcgiwrap + fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.socket; } + + # Enable compression for JS/CSS/HTML, for improved client load times. + # It might be nice to compress JSON/XML as returned by the API, but + # leaving that out to protect against potential BREACH attack. + gzip on; + gzip_vary on; + + gzip_types # text/html is always compressed by HttpGzipModule + text/css + application/javascript + font/truetype + font/opentype + application/vnd.ms-fontobject + image/svg+xml; } EOF -- cgit v1.2.3