Skip to content

Instantly share code, notes, and snippets.

@dchapman1988
Created December 27, 2011 19:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dchapman1988/1524826 to your computer and use it in GitHub Desktop.
Save dchapman1988/1524826 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
ServerAlias openx.example.com
DocumentRoot /home/deployer/myapp/current/public
PassengerSpawnMethod conservative
RackBaseURI /
RackEnv production
<Directory /home/deployer/myapp/current/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location /var/www/openx>
PassengerEnabled off
Options FollowSymlinks
Order allow,deny
Allow from all
</Location>
LogLevel info
ErrorLog /var/log/apache2/myapp-error.log
CustomLog /var/log/apache2/myapp-access.log combined
RewriteEngine On
RewriteLog /var/log/apache2/myapp-rewrite.log
RewriteLogLevel 0
# Canonical host
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteCond %{HTTP_HOST} !^openx.example.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/openx
ServerName openx.example.com
<Directory />
PassengerEnabled off
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/openx>
PassengerEnabled off
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
RewriteEngine On
RewriteLog /var/log/apache2/myapp-rewrite.log
RewriteLogLevel 0
RewriteCond %{HTTP_HOST} !^openx.example.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*)$ http://openx.example.com/$1 [L,R=301]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment