mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-10 15:57:30 -05:00
20 lines
471 B
Bash
20 lines
471 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Render the config from template
|
|
envsubst '$DOMAIN_NAME' < /etc/nginx/conf.d/site.template > /etc/nginx/conf.d/default.conf
|
|
|
|
# Test Nginx config
|
|
nginx -t
|
|
|
|
# Background job: reload Nginx every 6 hours to pick up new certs
|
|
(
|
|
while true; do
|
|
sleep 6h
|
|
echo "[nginx] Reloading config..."
|
|
nginx -s reload && echo "[nginx] Reload succeeded" || echo "[nginx] Reload failed"
|
|
done
|
|
) &
|
|
|
|
# Start Nginx in the foreground
|
|
exec nginx -g 'daemon off;' |