summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-12-17 00:18:41 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-12-17 00:18:41 +0800
commitee9c98c4017702c839d1ed07eaa6a4166ca28f95 (patch)
tree741d6c910679f9bbff832c90185d2aa92f1226f3
parent1cb80b2d9f3245bfc9e3f02f84b6af681054131a (diff)
nginx: update
-rw-r--r--nginx/nginx.conf2
-rw-r--r--nginx/sites-available/vps58
2 files changed, 31 insertions, 29 deletions
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index f94c508..1b6d9ed 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_local $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 3985072..820f346 100644
--- a/nginx/sites-available/vps
+++ b/nginx/sites-available/vps
@@ -56,11 +56,21 @@ server {
56 56
57 # RSS Feed for various names 57 # RSS Feed for various names
58 # ref: https://blog.jim-nielsen.com/2021/feed-urls/ 58 # ref: https://blog.jim-nielsen.com/2021/feed-urls/
59 location ^~ (index.xml|atom.xml|feed.xml|feed.atom)$ { 59 location ~ (rss|index.xml|atom.xml|feed|feed.xml|feed.atom)$ {
60 alias /srv/http/feed.rss; 60 alias /srv/http/feed.rss;
61 add_header Content-Type "text/xml; charset=utf-8";
61 } 62 }
62 63
63 location ^~ \.html$ { 64 location ~ [^/]$ {
65 try_files $uri @rewrite_no_slash;
66 }
67
68 location @rewrite_no_slash {
69 add_header rewrite no_slash;
70 rewrite ^(.+)$ $1.html permanent;
71 }
72
73 location ~ \.html$ {
64 try_files $uri =404; 74 try_files $uri =404;
65 } 75 }
66 76
@@ -86,15 +96,6 @@ server {
86 alias /srv/rss/; 96 alias /srv/rss/;
87 } 97 }
88 98
89 location ~ [^/]$ {
90 try_files $uri @rewrite_no_slash;
91 }
92
93 location @rewrite_no_slash {
94 add_header rewrite no_slash;
95 rewrite ^(.+)$ $1.html permanent;
96 }
97
98 #location ~ /$ { 99 #location ~ /$ {
99 # try_files $uri @rewrite_slash; 100 # try_files $uri @rewrite_slash;
100 #} 101 #}
@@ -326,6 +327,15 @@ server {
326 root /usr/share/webapps/cgit; 327 root /usr/share/webapps/cgit;
327 try_files $uri @cgit; 328 try_files $uri @cgit;
328 329
330 location @cgit {
331 include fastcgi_params;
332 fastcgi_param SCRIPT_FILENAME /usr/local/lib/cgit/cgit.cgi;
333 fastcgi_param PATH_INFO $uri;
334 fastcgi_param QUERY_STRING $args;
335 fastcgi_param HTTP_HOST $server_name;
336 fastcgi_pass unix:/run/fcgiwrap.sock;
337 }
338
329 location = /favicon.ico { 339 location = /favicon.ico {
330 alias /srv/http/favicon.ico; 340 alias /srv/http/favicon.ico;
331 } 341 }
@@ -335,24 +345,16 @@ server {
335 } 345 }
336 346
337 # Configure HTTP transport 347 # Configure HTTP transport
338 location ~ /.+/(info/refs|git-upload-pack) { 348 #location ~ /.+/(info/refs|git-upload-pack) {
339 include fastcgi_params; 349 # include fastcgi_params;
340 fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; 350 # fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
341 fastcgi_param PATH_INFO $uri; 351 # fastcgi_param PATH_INFO $uri;
342 fastcgi_param GIT_HTTP_EXPORT_ALL 1; 352 # fastcgi_param GIT_HTTP_EXPORT_ALL 1;
343 fastcgi_param GIT_PROJECT_ROOT /srv/git; 353 # fastcgi_param GIT_PROJECT_ROOT /srv/git;
344 fastcgi_param HOME /srv/git; 354 # fastcgi_param HOME /srv/git;
345 fastcgi_pass unix:/run/fcgiwrap.sock; 355 # fastcgi_pass unix:/run/fcgiwrap.sock;
346 } 356 #}
347 357
348 location @cgit {
349 include fastcgi_params;
350 fastcgi_param SCRIPT_FILENAME /usr/local/lib/cgit/cgit.cgi;
351 fastcgi_param PATH_INFO $uri;
352 fastcgi_param QUERY_STRING $args;
353 fastcgi_param HTTP_HOST $server_name;
354 fastcgi_pass unix:/run/fcgiwrap.sock;
355 }
356} 358}
357 359
358# Block all direct accesses via IP address 360# Block all direct accesses via IP address