-
Notifications
You must be signed in to change notification settings - Fork 6
/
apache_sample_conf
46 lines (35 loc) · 1.32 KB
/
apache_sample_conf
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
WSGIPythonOptimize 2
<VirtualHost *:80>
ServerName www.<site.tld>
ServerAlias <site.tld>
ServerAdmin webmaster@<site.tld>
DocumentRoot /srv/www/eturn/public_html/
# mod_wsgi should run in daemonized mode, both directives nessesary
WSGIDaemonProcess <name> user=<name> threads=5 display-name=%{GROUP}
WSGIProcessGroup <name>
<Directory /srv/www/eturn/public_html/>
Options -Indexes FollowSymLinks ExecCGI
AddHandler wsgi-script .wsgi
RewriteEngine On
# Redirect all requests to main domain
RewriteCond %{HTTP_HOST} !www.<site.tld>
RewriteRule ^(.*)$ http://www.<site.tld>/$1 [R=301,L]
# If file is not found in DocumentRoot, pass request to wsgi handler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.wsgi/$1 [QSA,PT,L]
Order allow,deny
allow from all
</Directory>
# Add expires headers
<Location /static>
# Turn off redirecting to wsgi in /static/ location
RewriteEngine Off
<IfModule expires_module>
ExpiresActive On
ExpiresDefault "access plus 30 days"
</IfModule>
</Location>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/www.<site.tld>/error.log
CustomLog ${APACHE_LOG_DIR}/www.<site.tld>/access.log combined
</VirtualHost>