Blame view

resources/apache2-virtual-host.conf 2.4 KB
65f2cab9   hitier   Auto-Deploy files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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
f9f61c77   hitier   Set ssl on apache...
15
16
Define flaskapp_server_name your-server-name-comes-here
Define flaskapp_server_addr your-server-address-comes-here
e4465a86   hitier   More french insta...
17
Define flaskapp_subdir your-app-subdir or /
65f2cab9   hitier   Auto-Deploy files
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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

f9f61c77   hitier   Set ssl on apache...
34
<VirtualHost ${flaskapp_server_addr}:443>
65f2cab9   hitier   Auto-Deploy files
35
     # Add machine's IP address (use ifconfig command)
f9f61c77   hitier   Set ssl on apache...
36
37
38
39
40
41
     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
65f2cab9   hitier   Auto-Deploy files
42
43
44
45
46
47
48
     # 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
3c0785d6   hitier   Auto deploy to ap...
49
50
     # TransferLog ${flaskapp_path}/flaskapp-access.log
     # CustomLog  ${flaskapp_path}/flaskapp-custom.log combined
65f2cab9   hitier   Auto-Deploy files
51
52
53

     # python-home is the virtual env path
     # python-path sets the PYTHON_PATH for modules import
f9f61c77   hitier   Set ssl on apache...
54
     WSGIDaemonProcess ${flaskapp_server_name} \
65f2cab9   hitier   Auto-Deploy files
55
56
57
58
59
                        user=${flaskapp_user} group=${flaskapp_user} \
                        processes=2 threads=5 \
                        python-home=${flaskapp_path}/venv \
                        python-path=${flaskapp_path} \
                        display-name=%{GROUP}
af1ea318   hitier   Allow apache subd...
60
     WSGIScriptAlias /${flaskapp_subdir} ${flaskapp_path}/${flaskapp_wsgiscript}
f9f61c77   hitier   Set ssl on apache...
61
     WSGIProcessGroup ${flaskapp_server_name}
65f2cab9   hitier   Auto-Deploy files
62
63
64
65
66
67
68
69
70
71
72
73
     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