Skip to content

Instantly share code, notes, and snippets.

@mheiges
Last active September 26, 2015 06:48
Show Gist options
  • Save mheiges/1057055 to your computer and use it in GitHub Desktop.
Save mheiges/1057055 to your computer and use it in GitHub Desktop.
sample Apache HTTP Server virtual host configuration for EuPathDB franchises
#### required MACRO Substitutions #######
# %SERVERNAME% - server host name, e.g. adhemar.schistodb.org
# manually add a ServerAlias if needed, e.g. www.shistodb.org
# %WEBAPP% - name of Tomcat webapp. e.g. schisto.adhemar
# %PROJECT% - project name, e.g. SchistoDB
# %ADMIN_EMAIL% - administrative email for server, e.g. root@schistodb.org
# %TC_PORT% - Tomcat HTTP port
##########################################
<VirtualHost *:80>
ServerName %SERVERNAME%
#---------------------------------------------------------------------#
# Uncomment and reload to disable site #
#---------------------------------------------------------------------#
#Redirect 503 /
#ErrorDocument 503 '%SERVERNAME% is temporarily offline.'
#---------------------------------------------------------------------#
# Update ENV (for cgi) #
#---------------------------------------------------------------------#
SetEnv GUS_HOME /var/www/%SERVERNAME%/gus_home
SetEnv PERL5LIB /var/www/%SERVERNAME%/cgi-lib:/var/www/%SERVERNAME%/gus_home/lib
/perl
SetEnv PROJECT_ID %PROJECT%
DocumentRoot "/var/www/%SERVERNAME%/html"
#---------------------------------------------------------------------#
# Misc #
#---------------------------------------------------------------------#
DirectoryIndex home.jsp index.jsp index.html index.shtml index.php
ServerAdmin %ADMIN_EMAIL%
AddType application/rss+xml .rss
AddType application/octet-stream .fasta
AddType application/octet-stream .gff
AddType video/x-ms-wmv .wmv
#---------------------------------------------------------------------#
# Rewrite Rules (General, other sites have similar) #
#---------------------------------------------------------------------#
RewriteEngine on
# redirection to Tomcat
RewriteRule ^/+$ /%WEBAPP%/ [R,L]
ProxyPreserveHost On
ProxyPass /%WEBAPP% http://127.0.0.1:%TC_PORT%/%WEBAPP%
ProxyPassReverse /%WEBAPP% http://127.0.0.1:%TC_PORT%/%WEBAPP%
ProxyPass /webservices http://%SERVERNAME%/%WEBAPP%/webservices
ProxyPassReverse /webservices http://%SERVERNAME%/%WEBAPP%/webservices
# provide uniformly named access to static files (js, css, etc) served by Tomcat
ProxyPass /a http://%SERVERNAME%/%WEBAPP%
ProxyPassReverse /a http://%SERVERNAME%/%WEBAPP%
#---------------------------------------------------------------------#
# / (DocumentRoot) #
#---------------------------------------------------------------------#
<Directory "/var/www/%SERVERNAME%/html">
Options Includes FollowSymLinks
AllowOverride Limit AuthConfig
Order allow,deny
Allow from all
</Directory>
<Location /WEB-INF>
deny from all
</Location>
#---------------------------------------------------------------------#
# /cgi-bin #
#---------------------------------------------------------------------#
ScriptAlias /cgi-bin/ "/var/www/%SERVERNAME%/cgi-bin/"
ScriptAlias /bin/ "/var/www/%SERVERNAME%/cgi-bin/"
<Directory "/var/www/%SERVERNAME%/cgi-bin">
AllowOverride AuthConfig Limit
Options ExecCGI Includes
SetOutputFilter Includes
Order allow,deny
Allow from all
</Directory>
#---------------------------------------------------------------------#
# /common/downloads (allow Indexes) #
#---------------------------------------------------------------------#
Alias /common/downloads /var/www/Common/prodSiteFilesMirror/downloadSite/%PROJECT%
<Directory /var/www/Common/prodSiteFilesMirror/downloadSite/%PROJECT%>
Options Indexes FollowSymLinks Includes MultiViews
ReadmeName /include/fancyIndexFooter.shtml
HeaderName /include/fancyIndexHeader.shtml
IndexOptions SuppressHTMLPreamble FancyIndexing FoldersFirst IgnoreCase DescriptionWidth=*
IndexIgnore .??* *~ *# README*
AllowOverride Indexes
Order allow,deny
Allow from all
</Directory>
#---------------------------------------------------------------------#
# /common/community (allow Indexes) #
#---------------------------------------------------------------------#
Alias /common/community /var/www/Common/communityFilesMirror
<Directory /var/www/Common/communityFilesMirror>
Options Indexes FollowSymLinks Includes MultiViews
ReadmeName /include/fancyIndexFooter.shtml
HeaderName /include/fancyIndexHeader.shtml
IndexOptions SuppressHTMLPreamble FancyIndexing FoldersFirst IgnoreCase DescriptionWidth=*
IndexIgnore .??* *~ *# README*
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#---------------------------------------------------------------------#
# /common #
#---------------------------------------------------------------------#
Alias /common /var/www/Common/prodSiteFilesMirror/auxiliary/%PROJECT%
<Directory /var/www/Common/prodSiteFilesMirror/auxiliary/%PROJECT%>
Options FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#---------------------------------------------------------------------#
# RSS feeds #
#---------------------------------------------------------------------#
RewriteRule /news.rss /%WEBAPP%/showXmlDataContent.do?name=XmlQuestions.NewsRss [PT]
RewriteRule /events.rss /%WEBAPP%/communityEventsRss.jsp [PT]
RewriteRule /publications.rss /%WEBAPP%/showXmlDataContent.do?name=XmlQuestions.PublicationsRss [PT]
RewriteRule /releases.rss /%WEBAPP%/showXmlDataContent.do?name=XmlQuestions.ReleasesRss [PT]
#---------------------------------------------------------------------#
# Logging #
#---------------------------------------------------------------------#
CustomLog /var/log/httpd/%SERVERNAME%/access_log combined env=!self
CustomLog /var/log/httpd/%SERVERNAME%/agent_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
ErrorLog /var/log/httpd/%SERVERNAME%/error_log
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment