diff options
-rw-r--r-- | etc/rc.conf | 6 | ||||
-rw-r--r-- | usr/local/etc/cgitrc | 66 | ||||
-rw-r--r-- | usr/local/etc/nginx/nginx.conf | 70 |
3 files changed, 119 insertions, 23 deletions
diff --git a/etc/rc.conf b/etc/rc.conf index 8c8846a..08ab091 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -8,7 +8,11 @@ ipv6_activate_all_interfaces="YES" rtsold_enable="YES" rtsold_flags="-aF" nginx_enable="YES" -uwsgi_enable="YES" +fcgiwrap_enable="YES" +fcgiwrap_user="www" +fcgiwrap_group="www" +fcgiwrap_socket_owner="www" +fcgiwrap_socket_group="www" cron_flags="-m ''" gmid_enable="YES" pf_enable="NO" diff --git a/usr/local/etc/cgitrc b/usr/local/etc/cgitrc new file mode 100644 index 0000000..bf973e6 --- /dev/null +++ b/usr/local/etc/cgitrc @@ -0,0 +1,66 @@ +# +# cgit config +# + +css=/cgit.css +logo=/cgit.png + +favicon=/favicon.png + +# if you do not want that webcrawler (like google) index your site +robots=noindex, nofollow + +# if cgit messes up links, use a virtual-root. For example, cgit.example.org/ has this value: +virtual-root=/ + +root-title=GitJoe +root-desc=where the good code belongs + +clone-url=git://gitjoe.xyz/$CGIT_REPO_URL jozan@gitjoe.xyz:$CGIT_REPO_URL + +enable-index-owner=0 +enable-index-links=0 +enable-log-filecount=1 +enable-log-linecount=1 +enable-commit-graph=1 +enable-remote-branches=1 + +snapshots=tar.gz tar.bz tar.xz +max-stats=quarter +#root-readme=/usr/local/www/cgit/about.htm +#root-readme=/usr/home/git/repos/about + +enable-index-owner=1 + +readme=:README.md +readme=:readme.md +readme=:README.mkd +readme=:readme.mkd +readme=:README.rst +readme=:readme.rst +readme=:README.html +readme=:readme.html +readme=:README.htm +readme=:readme.htm +readme=:README.txt +readme=:readme.txt +readme=:README +readme=:readme +readme=:INSTALL.md +readme=:install.md +readme=:INSTALL.mkd +readme=:install.mkd +readme=:INSTALL.rst +readme=:install.rst +readme=:INSTALL.html +readme=:install.html +readme=:INSTALL.htm +readme=:install.htm +readme=:INSTALL.txt +readme=:install.txt +readme=:INSTALL +readme=:install + +#scan-path=/usr/local/git/jozan +#scan-path=/usr/local/git/salad +#include=/usr/local/etc/cgitrepos/jozan 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 |