diff options
Diffstat (limited to 'nginx')
-rw-r--r-- | nginx/nginx.conf | 2 | ||||
-rw-r--r-- | nginx/sites-available/vps | 52 |
2 files changed, 40 insertions, 14 deletions
diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 605f056..f94c508 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf | |||
@@ -33,7 +33,7 @@ http { | |||
33 | # '$status $body_bytes_sent "$http_referer" ' | 33 | # '$status $body_bytes_sent "$http_referer" ' |
34 | # '"$http_user_agent" "$http_x_forwarded_for"'; | 34 | # '"$http_user_agent" "$http_x_forwarded_for"'; |
35 | log_format main '$status $request_method\t$http_host$uri\tfrom $http_referer\n' | 35 | log_format main '$status $request_method\t$http_host$uri\tfrom $http_referer\n' |
36 | ' $time_iso8601 $remote_addr\r\t\t\t\t\t $http_user_agent'; | 36 | ' $time_iso8601 $remote_addr\r\t\t\t\t\t $http_user_agent'; |
37 | access_log /var/log/nginx/access.log main; | 37 | access_log /var/log/nginx/access.log main; |
38 | 38 | ||
39 | sendfile on; | 39 | sendfile on; |
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 | ||