diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-12-15 19:42:53 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-12-16 22:45:13 +0800 |
commit | 1cb80b2d9f3245bfc9e3f02f84b6af681054131a (patch) | |
tree | 47cbb38ce9e7b3e92b0262e35bf8dfcdbe929526 /nginx/sites-available | |
parent | 465c4ba5b4f0b4f69fd3773fc4f9f9650b7fffa0 (diff) |
add cgit
Diffstat (limited to 'nginx/sites-available')
-rw-r--r-- | nginx/sites-available/vps | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/nginx/sites-available/vps b/nginx/sites-available/vps index 75a789b..3985072 100644 --- a/nginx/sites-available/vps +++ b/nginx/sites-available/vps | |||
@@ -16,7 +16,7 @@ map $uri $basename { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | server { | 18 | server { |
19 | server_name topo.tw www.topo.tw "~[\d\.]+"; | 19 | server_name topo.tw www.topo.tw "~[\d\.]+" localhost; |
20 | 20 | ||
21 | listen 80; | 21 | listen 80; |
22 | listen 443 ssl; | 22 | listen 443 ssl; |
@@ -54,7 +54,13 @@ server { | |||
54 | error_log /var/log/nginx/error.log debug; | 54 | error_log /var/log/nginx/error.log debug; |
55 | #rewrite_log on; | 55 | #rewrite_log on; |
56 | 56 | ||
57 | location ~ \.html$ { | 57 | # RSS Feed for various names |
58 | # ref: https://blog.jim-nielsen.com/2021/feed-urls/ | ||
59 | location ^~ (index.xml|atom.xml|feed.xml|feed.atom)$ { | ||
60 | alias /srv/http/feed.rss; | ||
61 | } | ||
62 | |||
63 | location ^~ \.html$ { | ||
58 | try_files $uri =404; | 64 | try_files $uri =404; |
59 | } | 65 | } |
60 | 66 | ||
@@ -68,11 +74,11 @@ server { | |||
68 | fancyindex_ignore Makefile fastcgi.*; | 74 | fancyindex_ignore Makefile fastcgi.*; |
69 | } | 75 | } |
70 | 76 | ||
71 | location ~ /cgi/(.*) { | 77 | location ^~ /cgi/ { |
72 | gzip off; | 78 | gzip off; |
73 | include /etc/nginx/fastcgi_params; | 79 | include /etc/nginx/fastcgi_params; |
74 | fastcgi_pass unix:/srv/cgi/fastcgi.sock; | 80 | fastcgi_pass unix:/run/fcgiwrap.sock; |
75 | fastcgi_param SCRIPT_FILENAME /srv/cgi/$1; | 81 | fastcgi_param SCRIPT_FILENAME /srv/cgi/$basename; |
76 | error_log /tmp/cgi info; | 82 | error_log /tmp/cgi info; |
77 | } | 83 | } |
78 | 84 | ||
@@ -317,15 +323,35 @@ server { | |||
317 | ssl_certificate /etc/nginx/ssl/git.topo.tw/fullchain.cer; | 323 | ssl_certificate /etc/nginx/ssl/git.topo.tw/fullchain.cer; |
318 | ssl_certificate_key /etc/nginx/ssl/git.topo.tw/git.topo.tw.key; | 324 | ssl_certificate_key /etc/nginx/ssl/git.topo.tw/git.topo.tw.key; |
319 | 325 | ||
320 | root /srv/git/www; | 326 | root /usr/share/webapps/cgit; |
327 | try_files $uri @cgit; | ||
328 | |||
329 | location = /favicon.ico { | ||
330 | alias /srv/http/favicon.ico; | ||
331 | } | ||
332 | |||
333 | location = /logo.svg { | ||
334 | alias /home/pham/site/git/logo.svg; | ||
335 | } | ||
336 | |||
337 | # Configure HTTP transport | ||
338 | location ~ /.+/(info/refs|git-upload-pack) { | ||
339 | include fastcgi_params; | ||
340 | fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; | ||
341 | fastcgi_param PATH_INFO $uri; | ||
342 | fastcgi_param GIT_HTTP_EXPORT_ALL 1; | ||
343 | fastcgi_param GIT_PROJECT_ROOT /srv/git; | ||
344 | fastcgi_param HOME /srv/git; | ||
345 | fastcgi_pass unix:/run/fcgiwrap.sock; | ||
346 | } | ||
321 | 347 | ||
322 | location ~ (/.*) { | 348 | location @cgit { |
323 | #include fastcgi_params; | 349 | include fastcgi_params; |
324 | #fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; | 350 | fastcgi_param SCRIPT_FILENAME /usr/local/lib/cgit/cgit.cgi; |
325 | ## export all repositories under GIT_PROJECT_ROOT | 351 | fastcgi_param PATH_INFO $uri; |
326 | #fastcgi_param GIT_HTTP_EXPORT_ALL ""; | 352 | fastcgi_param QUERY_STRING $args; |
327 | #fastcgi_param GIT_PROJECT_ROOT /srv/git; | 353 | fastcgi_param HTTP_HOST $server_name; |
328 | #fastcgi_param PATH_INFO $1; | 354 | fastcgi_pass unix:/run/fcgiwrap.sock; |
329 | } | 355 | } |
330 | } | 356 | } |
331 | 357 | ||