# Apache virtual host conf file for Climso-Web web-app # # Will map a server name and an url to the wsgi script. # # Allows to use a python virtualenvironment thanks to two WSGIDaemonProcess # attributes: # python-home # python-path # Edit Configuration # Define flaskapp_path /var/www/html/pdc-web Define flaskapp_wsgiscript pdc_web.wsgi Define flaskapp_server_name your-server-name-comes-here Define flaskapp_server_addr your-server-address-comes-here Define flaskapp_subdir your-app-subdir or / Define flaskapp_user apache Define flaskapp_group apache # Warning: # -------- # # Stdout/Stderr wont be logged in per virtualhost log files. # # 1- Unsuccessfull tries to fix it: # # WSGIRestrictEmbedded On # WSGIRestrictStdout Off # # 2- what works is to comment out ErrorLog, TransferLog and CustomLog # and let apache log everything in global log files # Add machine's IP address (use ifconfig command) ServerName ${flaskapp_server_name} # https stuf SSLEngine on SSLProtocol all -SSLv2 SSLCertificateFile /etc/pki/tls/certs/localhost.crt SSLCertificateKeyFile /etc/pki/tls/private/localhost.key # Give an alias to to start your website url with DocumentRoot ${flaskapp_path} LogLevel warn LogFormat "%a %l %u %t \"%r\" %>s %b" # # Virtualhost log config doesnt show stdout/err see before # ErrorLog ${flaskapp_path}/flaskapp-error.log # TransferLog ${flaskapp_path}/flaskapp-access.log # CustomLog ${flaskapp_path}/flaskapp-custom.log combined # python-home is the virtual env path # python-path sets the PYTHON_PATH for modules import WSGIDaemonProcess ${flaskapp_server_name} \ user=${flaskapp_user} group=${flaskapp_user} \ processes=2 threads=5 \ python-home=${flaskapp_path}/venv \ python-path=${flaskapp_path} \ display-name=%{GROUP} WSGIScriptAlias /${flaskapp_subdir} ${flaskapp_path}/${flaskapp_wsgiscript} WSGIProcessGroup ${flaskapp_server_name} WSGIApplicationGroup %{GLOBAL} # set permissions as per apache2.conf file Options -Indexes -MultiViews +FollowSymLinks AllowOverride All Require all granted # vim: tabstop=4 sw=4 et tw=0