Last active
July 14, 2017 17:22
-
-
Save erickpeirson/4239bf20bd7c5c157fd6561e50267c4f to your computer and use it in GitHub Desktop.
mod_wsgi with Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
WSGIDaemonProcess references user=apache group=apache threads=5 python-path=/opt/reflink/arxiv-reflink:/opt/reflink/venv/lib/python3.5/site-packages:/opt/reflink/venv/lib64/python3.5/site-packages home=/opt/reflink/arxiv-reflink | |
WSGIScriptAlias / /opt/reflink/arxiv-reflink/reflink.wsgi process-group=references | |
<Directory /opt/reflink/arxiv-reflink> | |
WSGIProcessGroup references | |
WSGIApplicationGroup %{GLOBAL} | |
WSGIScriptReloading On | |
Require all granted | |
</Directory> | |
</VirtualHost> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerRoot "/etc/httpd" | |
Listen 80 | |
# Dynamic Shared Object (DSO) Support | |
Include conf.modules.d/*.conf | |
User apache | |
Group apache | |
ServerAdmin brp53@cornell.edu | |
<Files ".ht*"> | |
Require all denied | |
</Files> | |
ErrorLog "logs/error_log" | |
LogLevel warn | |
<IfModule log_config_module> | |
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | |
LogFormat "%h %l %u %t \"%r\" %>s %b" common | |
<IfModule logio_module> | |
# You need to enable mod_logio.c to use %I and %O | |
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | |
</IfModule> | |
CustomLog "logs/access_log" combined | |
</IfModule> | |
<IfModule mime_module> | |
TypesConfig /etc/mime.types | |
AddType application/x-compress .Z | |
AddType application/x-gzip .gz .tgz | |
AddType text/html .shtml | |
AddOutputFilter INCLUDES .shtml | |
</IfModule> | |
AddDefaultCharset UTF-8 | |
<IfModule mime_magic_module> | |
MIMEMagicFile conf/magic | |
</IfModule> | |
EnableSendfile on | |
IncludeOptional conf.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: make sure apache, other libraries are installed | |
yum: | |
name: | |
- httpd24 | |
- httpd24-devel | |
- uuid | |
- libuuid-devel | |
- make | |
- gcc | |
- gcc-c++ | |
- python35-devel | |
state: present | |
- name: unarchive mod_wsgi | |
unarchive: | |
src: files/mod_wsgi-4.5.15.tar.gz | |
dest: /opt | |
creates: /opt/mod_wsgi-4.5.15 | |
- name: clean up mod_wsgi | |
command: make clean | |
args: | |
chdir: /opt/mod_wsgi-4.5.15 | |
- name: clean up mod_wsgi, | |
command: make distclean | |
args: | |
chdir: /opt/mod_wsgi-4.5.15 | |
- name: configure mod_wsgi build | |
command: ./configure --with-python=/usr/bin/python3 | |
args: | |
chdir: /opt/mod_wsgi-4.5.15 | |
# creates: /opt/mod_wsgi-4.5.15/Makefile | |
- name: build mod_wsgi | |
command: make | |
args: | |
chdir: /opt/mod_wsgi-4.5.15 | |
- name: install mod_wsgi | |
command: make install | |
args: | |
chdir: /opt/mod_wsgi-4.5.15 | |
- name: give apache execute access | |
file: | |
path: /opt/reflink/arxiv-reflink | |
owner: apache | |
group: apache | |
recurse: yes | |
mode: 0755 | |
- name: send custom apache configuration file | |
copy: | |
src: files/httpd.conf | |
dest: /etc/httpd/conf/httpd.conf | |
force: yes | |
- name: send mod_wsgi configuration file | |
copy: | |
src: files/mod_wsgi.conf | |
dest: /etc/httpd/conf.modules.d/mod_wsgi.conf | |
force: yes | |
- name: send reflink configuration file | |
copy: | |
src: files/arxiv-reflink.conf | |
dest: /etc/httpd/conf.d/arxiv-reflink.conf | |
force: yes | |
- name: enable and start service | |
service: | |
name: httpd | |
enabled: yes | |
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment