Skip to content

Instantly share code, notes, and snippets.

@nfreear
Created August 30, 2012 09:00
Show Gist options
  • Save nfreear/3524532 to your computer and use it in GitHub Desktop.
Save nfreear/3524532 to your computer and use it in GitHub Desktop.
Apache/ httpd virtualhost/ server configuration, with compression, persistence..
## Apache configuration for track.olnet.org (JISC Track OER project).
## N.D.Freear, 8 August 2012.
#httpd.conf: Include conf.d/*.conf
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
ServerTokens ProductOnly
#
# Demo/ test site: track.olnet.org
#
# Gzip/ mod_deflate
#http://geekride.com/apache-enable-mod_deflate-mod_gzip-module-compression-site-optimise
<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|flv|pdf|exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
</Location>
# Or, compress certain file types by extension:
<Files ~ "\.(css|js|html|htm|txt|json|xml)$">
SetOutputFilter DEFLATE
</Files>
# Persistent connections: server config, vhost.
KeepAlive On
# KeepAliveTimeout default 15
KeepAliveTimeout 15
# MaxKeepAliveRequests default 100
MaxKeepAliveRequests 200
#TimeOut 300
<VirtualHost *:80>
ServerName track.olnet.org
ServerAlias HOST.ALIAS
DocumentRoot /PATH/TO/trackoer
ServerAdmin iet-webmaster@open.ac.uk
ErrorLog logs/track.olnet.org-error_log
CustomLog logs/track.olnet.org-access_log common
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLog "/etc/httpd/logs/rewrite.log"
RewriteLogLevel 1
#1-9
##RewriteMap x-map-txt txt:/PATH/TO/x_files/rewrite_map.txt
</IfModule>
</VirtualHost>
<Directory "/PATH/TO/trackoer">
Order allow,deny
Allow from all
AllowOverride All
# Deny OR Allow Folder Indexes.
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# mod_rewrite rules
RewriteEngine on
</IfModule>
# If Mod_rewrite is NOT installed go to index.php
#<IfModule !mod_rewrite.c>
# ErrorDocument 404 index.php
#</IfModule>
</Directory>
<Directory "/PATH/TO/trackoer">
#Deny from all
</Directory>
<Directory "/PATH/TO/trackoer">
Allow from all
</Directory>
#[End.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment