Skip to content

Instantly share code, notes, and snippets.

@rambo
Created November 21, 2015 18:15
Show Gist options
  • Save rambo/dece72c04f0361027a2f to your computer and use it in GitHub Desktop.
Save rambo/dece72c04f0361027a2f to your computer and use it in GitHub Desktop.
Autostart and proxy to port 80 for https://github.com/tanelikaivola/lottacnc
server {
listen 80;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:5002;
}
}
# /etc/init/lottacnc.conf
description "Start the LottaCNC Flask app on boot"
author "Eero af Heurlin <rambo@iki.fi>"
env USERNAME=lottacnc
env APP_DIR=/opt/lottacnc
# We need to bind to localhost at least
start on ( filesystem \
and net-device-up IFACE=lo)
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
cd $APP_DIR
exec su $USERNAME -c "python run.py"
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment