apache-python3.conf
2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Apache virtual host conf file for Heliopropa 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 /home/richard/00DEV/SPACEWEATHERONLINE
Define flaskapp_wsgiscript heliopropa.wsgi
Define flaskapp_server_name heliopropa
Define flaskapp_server_addr 127.0.0.1
Define flaskapp_subdir /
Define flaskapp_user www-data
Define flaskapp_group www-data
# 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
#
# 3- However you should prefer to manage your own log system from inside web-app
#
#
<VirtualHost ${flaskapp_server_addr}:443>
# 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}
<Directory ${flaskapp_path}>
# set permissions as per apache2.conf file
Options -Indexes -MultiViews +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# vim: tabstop=4 sw=4 et tw=0