diff --git a/README.md b/README.md index 7d57ab1..056aa1a 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,77 @@ If you want to host this somewhere more prominent following links could help: (s * https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension * http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd * http://stackoverflow.com/questions/30763586/starting-bottle-web-server-through-systemd + + +This is what i did on an Ubuntu 16.04 server with apache2: + + +I enabled following Apache modules (for future instance balancing plans): +``` +a2enmod proxy +a2enmod proxy_http +a2enmod proxy_ajp +a2enmod rewrite +a2enmod deflate +a2enmod headers +a2enmod proxy_balancer +a2enmod proxy_connect +a2enmod proxy_html +a2enmod xml2enc +``` +Apache vhost config: +``` + + DocumentRoot /var/www/accounts/static + ServerAdmin admin@domain.tld + ServerName accounts.domain.tld + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/accounts_access.log combined + + Redirect permanent / https://accounts.domain.tld/ + + + + + + ServerAdmin admin@domain.tld + ServerName accounts.domain.tld + DocumentRoot /var/www/accounts/static + + ErrorLog ${APACHE_LOG_DIR}/accounts_ssl_error.log + LogLevel warn + CustomLog ${APACHE_LOG_DIR}/accounts_ssl_access.log combined + + SSLEngine on + SSLCertificateFile /path/to/fullchain.pem + SSLCertificateKeyFile /path/to/key.pem + + ProxyPreserveHost On + ProxyPass / http://localhost:8000/ + ProxyPassReverse / http://localhost:8000/ + + + +``` +Unit file for systemd. `/lib/systemd/system/accounts.service` +Enable service with `sudo systemctl enable accounts.service` +``` +[Unit] +Description=Accounts App +After=multi-user.target + +[Service] +Type=simple +User=www-data +Group=www-data +WorkingDirectory=/var/www/accounts +ExecStart=/usr/bin/python3 /var/www/accounts/app.py +StandardOutput=syslog +StandardError=syslog +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target +```