Finish headless Debian operation and document CDN origin deployment
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Preserve existing sites. Prefer a domain certificate; CDN IP origins can use
|
||||
# the server's existing valid IP certificate when HTTP-01 is unavailable.
|
||||
set -euo pipefail
|
||||
root=/opt/kaoyan-studio-deploy/app
|
||||
test -f /etc/nginx/kaoyan-studio.htpasswd
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
root = Path('/opt/kaoyan-studio-deploy/app/deploy')
|
||||
text = (root / 'nginx-http-bootstrap.conf').read_text() + '\n' + (root / 'nginx-https.conf').read_text()
|
||||
cert = Path('/etc/letsencrypt/live/kaoyan.fjayson.com/fullchain.pem')
|
||||
if not cert.exists():
|
||||
replacement = '/etc/letsencrypt/live/186.241.68.230/'
|
||||
if not Path(replacement, 'fullchain.pem').exists():
|
||||
raise SystemExit('Install a valid origin certificate before configuring HTTPS')
|
||||
text = text.replace('/etc/letsencrypt/live/kaoyan.fjayson.com/', replacement)
|
||||
Path('/etc/nginx/sites-available/kaoyan-studio').write_text(text)
|
||||
PY
|
||||
ln -sfn /etc/nginx/sites-available/kaoyan-studio /etc/nginx/sites-enabled/kaoyan-studio
|
||||
nginx -t
|
||||
systemctl reload nginx
|
||||
@@ -8,6 +8,11 @@ server {
|
||||
client_max_body_size 100m;
|
||||
auth_basic "Kaoyan Workbench";
|
||||
auth_basic_user_file /etc/nginx/kaoyan-studio.htpasswd;
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/kaoyan-acme;
|
||||
auth_basic off;
|
||||
add_header Cache-Control no-store;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8765;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
Reference in New Issue
Block a user