nginx: add ntfy

Signed-off-by: creme <creme@envs.net>
This commit is contained in:
creme 2022-10-11 17:29:06 +00:00
parent 385f3a776a
commit bfd55de568
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,68 @@
### NTFY.ENVS.NET - local redirect ###
server {
include snippets/listen.conf;
server_name ntfy.envs.net;
location / {
# Redirect HTTP to HTTPS, but only for GET topic addresses, since we want
# it to work with curl without the annoying https:// prefix
set $redirect_https "";
if ($request_method = GET) {
set $redirect_https "yes";
}
if ($request_uri ~* "^/([-_a-z0-9]{0,64}$|docs/|static/)") {
set $redirect_https "${redirect_https}yes";
}
if ($redirect_https = "yesyes") {
return 302 https://$http_host$request_uri$is_args$query_string;
}
proxy_pass http://127.0.0.1:2586;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3m;
proxy_send_timeout 3m;
proxy_read_timeout 3m;
client_max_body_size 20m; # Must be >= attachment-file-size-limit in /etc/ntfy/server.yml
}
}
server {
include snippets/listen_ssl.conf;
server_name ntfy.envs.net;
include snippets/ssl.conf;
include ssl/envs_net_wild.conf;
include snippets/local_ssl_header.conf;
ssl_session_cache builtin:1000 shared:SSL:10m;
location / {
proxy_pass http://127.0.0.1:2586;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3m;
proxy_send_timeout 3m;
proxy_read_timeout 3m;
client_max_body_size 20m; # Must be >= attachment-file-size-limit in /etc/ntfy/server.yml
}
}

View File

@ -0,0 +1 @@
/etc/nginx/sites-available/ntfy.envs.net.conf