diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-03-03 01:17:41 +0000 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-03-03 01:17:41 +0000 |
commit | 8b63e61068efedd325e3458aa75eddf244d1be5d (patch) | |
tree | e25d2d31c7bb86bbf39fad11cc9625b37bcca3d8 /etc/nginx | |
parent | e336a1eba3ddb3f002ca3b73c2144b51199e5296 (diff) |
maybe improve nginx.conf location regex a little bit
Diffstat (limited to 'etc/nginx')
-rw-r--r-- | etc/nginx/nginx.conf | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index 17b23af5..011a9b52 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -163,8 +163,17 @@ http { ssl_certificate /etc/nginx/flylightning.pem; ssl_certificate_key /etc/nginx/flylightning.key; + # about nginx location regex: + # - https://nginx.org/en/docs/http/ngx_http_core_module.html#location + # - https://stackoverflow.com/a/59846239 + # - note in nginx / only means / and no other meaning, so no need \/ + # - ~ means case-sensitive regex + # about (?:) non-capturing group: + # - https://manifold.net/doc/radian/why_do_non-capture_groups_exist_.htm + # - non-capturing group won't capture things inside () which may use later like in sed \1 + # - maybe improve a little bit performance by not storing things (not tested, also I did not read the source code) # Serve static files with nginx - location ~* ^.+(cgit.(css|png)|favicon.ico|robots.txt|highlight.css|mycgit.css) { + location ~ ^/(?:cgit\.(?:css|png)|favicon\.ico|robots\.txt|highlight\.css|mycgit\.css)$ { root /usr/share/webapps/cgit; expires 30d; } |