add uptimerobot redirect

master
Paul Walko 2021-05-26 05:18:24 +02:00
parent 62a78c89ce
commit 63788a1935
2 changed files with 60 additions and 2 deletions

View File

@ -1,6 +1,8 @@
## Based on version below; heavily modified for me
## Version 2018/09/12 - Changelog: https://github.com/linuxserver/docker-letsencrypt/commits/master/root/defaults/default
### madone ###
# Redirect HTTPS to HTTP
server {
listen 80;
@ -33,3 +35,43 @@ server {
proxy_read_timeout 8h;
}
}
### uptime ###
# Redirect HTTPS to HTTP
server {
listen 80;
listen [::]:80;
server_name uptime.seaturtle.pw;
return 301 https://uptime.seaturtle.pw$request_uri;
}
# Reference: https://gist.github.com/CodeCrafter912/4305d5a1873e2a220e7da848b87be937
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name uptime.seaturtle.pw;
set $monitorId zx0Y5uROBD;
# ssl conf
include /config/nginx/ssl.conf;
client_max_body_size 1M;
location / {
proxy_set_header Host "stats.uptimerobot.com";
proxy_set_header Accept-Encoding "";
proxy_pass_request_headers on;
proxy_pass https://stats.uptimerobot.com/;
proxy_ssl_server_name on;
rewrite ^\/([0-9]+) /$monitorId/$1 break;
rewrite ^\/$ /$monitorId break;
sub_filter_once off;
sub_filter_types text/html;
sub_filter "stats.uptimerobot.com" "$host";
sub_filter "https://stats.uptimerobot.com/$monitorId" "https://$host";
}
}

View File

@ -1,5 +1,8 @@
#!/bin/bash
set -e
up () {
docker run \
--name nginx \
--detach \
@ -9,7 +12,7 @@ docker run \
--env EMAIL=sysadmin@seaturtle.pw \
--env URL=seaturtle.pw \
--env ONLY_SUBDOMAINS=true \
--env SUBDOMAINS=madone \
--env SUBDOMAINS=madone,uptime \
--env VALIDATION=html \
--env TZ=US/Eastern \
--volume $PWD/nginx-config:/config:rw \
@ -20,3 +23,16 @@ docker run \
--publish [2001:bc8:6005:19:208:a2ff:fe0c:917c]:80:80 \
--publish [2001:bc8:6005:19:208:a2ff:fe0c:917c]:443:443 \
linuxserver/letsencrypt:1.3.0-ls110
}
down () {
docker stop nginx || true
docker rm nginx || true
}
logs () {
docker logs -f nginx
}
$@