apache2-virtual-host.conf
2.07 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
# 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 pdc-it1.irap.omp.eu
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
<VirtualHost ${flaskapp_server}:80>
# Add machine's IP address (use ifconfig command)
ServerName ${flaskapp_server}
# 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}/aroma-access.log
# CustomLog ${flaskapp_path}/aroma-custom.log combined
# python-home is the virtual env path
# python-path sets the PYTHON_PATH for modules import
WSGIDaemonProcess ${flaskapp_server} \
user=${flaskapp_user} group=${flaskapp_user} \
processes=2 threads=5 \
python-home=${flaskapp_path}/venv \
python-path=${flaskapp_path} \
display-name=%{GROUP}
WSGIScriptAlias / ${flaskapp_path}/${flaskapp_wsgiscript}
WSGIProcessGroup ${flaskapp_server}
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