Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created September 21, 2012 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wboykinm/3759682 to your computer and use it in GitHub Desktop.
Save wboykinm/3759682 to your computer and use it in GitHub Desktop.
DB apache config
# Copyright 2010 Micah Altman, Michael McDonald
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is part of The Public Mapping Project
# https://github.com/PublicMapping/
#
# Purpose:
# publicmapping.apache is an Apache HTTP configuration file.
#
# This file configures the web server to serve up The Public Mapping
# Project out of /, and configures a django WSGI application. In
# addition, the static media for the django web application is
# served up through a set of aliased paths.
#
# Author:
# Andrew Jennings, David Zwarg
#
<IfDefine !nobuilder>
<VirtualHost *:80>
ServerAdmin AzaveaDev@azavea.com
WSGIDaemonProcess geodjango user=www-data group=www-data processes=10 threads=1 display-name=publicmapping
WSGIProcessGroup geodjango
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /projects/DistrictBuilder/django/publicmapping.wsgi
Alias /static-media/ /projects/DistrictBuilder/django/publicmapping/static-media/
<Directory /projects//DistrictBuilder/django/publicmapping/static-media>
Order deny,allow
Allow from all
</Directory>
Alias /reports/ /projects/local/reports/
<Directory /projects/local/reports/>
Options Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>
Alias /sld/ /projects/DistrictBuilder/sld/
<Directory /projects/DistrictBuilder/sld/>
Options Indexes
Order deny,allow
Allow from all
</Directory>
Alias /docs/ /projects/DistrictBuilder/docs/html/
<Directory /projects/DistrictBuilder/docs/html/>
Options Indexes
Order deny,allow
Allow from all
</Directory>
Alias /data/ /projects/local/data/
<Directory /projects/local/data/>
Options Indexes
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/publicmapping-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/publicmapping-access.log combined
RewriteEngine On
# This redirects report requests to an alternate port.
RewriteRule ^/reporting/getreport/$ http://localhost:8081/getreport/ [NC,P]
# You can comment out this rewriterule and adjust your map server name accordingly to stop proxying
# map requests through apache
RewriteRule /geoserver/(.*) http://%{HTTP_HOST}:8080/geoserver/$1 [NC,P]
RewriteLog /var/log/apache2/publicmapping-rewrite.log
RewriteLogLevel 0
</VirtualHost>
</IfDefine>
<IfDefine !noreporting>
<IfDefine nobuilder>
# All traffic on port 80 should be redirected to the reporting port
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*) http://%{HTTP_HOST}:8081$1 [R,L]
</VirtualHost>
</IfDefine>
# Necessary to keep rPy2 from throwing exceptions
WSGIRestrictStdout Off
# This virtual host is responsible for running a multithreaded environment for reports
NameVirtualHost *:8081
Listen 8081
<VirtualHost *:8081>
ServerAdmin AzaveaDev@azavea.com
WSGIDaemonProcess bard-reports user=www-data group=www-data processes=1 threads=1 display-name=publicmapping-reports
WSGIScriptAlias / /projects/DistrictBuilder/django/reports.wsgi
WSGIProcessGroup bard-reports
WSGIApplicationGroup bard-reports
ErrorLog /var/log/apache2/bard-reporting-error.log
CustomLog /var/log/apache2/bard-reporting-access.log combined
LogLevel warn
# This virtual host needs a longer timeout because of reports
Timeout 600
# These requests are proxied through the secure server. Non-local access forbidden.
<IfDefine !nobuilder>
<Directory />
Order deny,allow
Deny from all
Allow from 127.0.0.1/16
</Directory>
</IfDefine>
</VirtualHost>
</IfDefine>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment