2017-09-24 14:01:03 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import os
|
2017-09-24 17:50:10 +02:00
|
|
|
import subprocess
|
|
|
|
|
2017-12-03 11:28:26 +01:00
|
|
|
# Check if a stale pid file exists
|
|
|
|
if os.path.exists("/var/log/nginx.pid"):
|
|
|
|
os.remove("/var/log/nginx.pid")
|
2017-09-24 14:01:03 +02:00
|
|
|
|
|
|
|
# Actual startup script
|
2017-09-24 17:50:10 +02:00
|
|
|
if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls":
|
|
|
|
os.system("openssl dhparam -out /certs/dhparam.pem 4096")
|
|
|
|
|
|
|
|
if os.environ["TLS_FLAVOR"] == "letsencrypt":
|
|
|
|
subprocess.Popen(["/letsencrypt.py"])
|
|
|
|
|
|
|
|
subprocess.call(["/config.py"])
|
2017-09-24 14:01:03 +02:00
|
|
|
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
|