diff options
Diffstat (limited to 'usr/local/etc/nginx/nginx.conf')
-rw-r--r-- | usr/local/etc/nginx/nginx.conf | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/usr/local/etc/nginx/nginx.conf b/usr/local/etc/nginx/nginx.conf index 4b4381b..4f307ab 100644 --- a/usr/local/etc/nginx/nginx.conf +++ b/usr/local/etc/nginx/nginx.conf @@ -11,8 +11,13 @@ http { keepalive_timeout 65; gzip on; gzip_vary on; - gzip_min_length 1024; + gzip_min_length 1k; gzip_proxied expired no-cache no-store private auth; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/x-javascript application/javascript text/css application/xml application/json; + map $sent_http_content_type $expires { default off; text/css 15m; @@ -20,15 +25,14 @@ http { ~image/ 15m; } - server{ - server_name jozanofastora.xyz; + server_name jozanofastora.xyz www.jozanofastora.xyz; + root /usr/local/www/jozan; + index index.html; expires $expires; location / { - root /usr/local/www/jozan; try_files $uri $uri/ =404; - index index.html; } location ~ /\.ht { deny all; @@ -56,16 +60,33 @@ http { } server{ - server_name gitjoe.xyz git.jozanofastora.xyz; + server_name gitjoe.xyz www.gitjoe.xyz git.jozanofastora.xyz; expires $expires; + root /usr/local/www/gitjoe; + index index.html; + location / { - root /usr/local/www/gitjoe; - index index.html; try_files $uri $uri/ =404; } location ~ /\.ht { deny all; } + location @jozan { + include fastcgi_params; + root /usr/local/www/gitjoe/jozan; + try_files $uri @jozan; + index cgit.cgi; + fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $args; + fastcgi_param HTTP_HOST $server_name; + fastcgi_param CGIT_CONFIG /usr/local/etc/cgitusers/jozan; + fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; + + gzip off; + #rewrite ^ https://$server_name$request_uri permanent; + rewrite ^/([^/]+/.*)?$ /cgit.cgi?url=$1 break; + } error_page 403 /403.html; location = /403.html { root /usr/local/www/gitjoe/err; @@ -93,21 +114,27 @@ http { listen 80; server_name cgit.gitjoe.xyz; root /usr/local/www/cgit; + try_files $uri @cgit; + index cgit.cgi; - # Serve static files with nginx - location ~* ^.+(cgit.(css|png)|favicon.ico|robots.txt) { - root /usr/local/www/cgit; - expires 30d; - } - location / { - try_files $uri @cgit; - } location @cgit { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $args; + fastcgi_param HTTP_HOST $server_name; + fastcgi_param CGIT_CONFIG /usr/local/etc/cgitrc; + fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; + gzip off; - include uwsgi_params; - uwsgi_modifier1 9; - uwsgi_pass unix:/var/run/uwsgi/cgit.sock; + #rewrite ^ https://$server_name$request_uri permanent; + rewrite ^/([^/]+/.*)?$ /cgit.cgi?url=$1 break; } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/local/www/nginx-dist; + } + } server { @@ -160,8 +187,7 @@ server{ return 301 https://$host$request_uri; } # managed by Certbot - - server_name gitjoe.xyz; + server_name gitjoe.xyz www.gitjoe.xyz git.jozanofastora.xyz; listen 80; return 404; # managed by Certbot @@ -180,7 +206,7 @@ server{ } # managed by Certbot - server_name jozanofastora.xyz; + server_name jozanofastora.xyz www.jozanofastora.xyz; listen 80; return 404; # managed by Certbot |