Skip to content

Instantly share code, notes, and snippets.

@SeanHayes
Created July 2, 2010 18:19
Show Gist options
  • Save SeanHayes/461702 to your computer and use it in GitHub Desktop.
Save SeanHayes/461702 to your computer and use it in GitHub Desktop.
Example Apache config file for enabling HTTP & HTTPS on the same website
#NOTE: This is only used on my laptop for development purposes.
#HTTP config
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName website.localhost
DocumentRoot /web/website
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /web/website>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /web/website/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /web/website/access.log combined
#turn off cache for development
Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
Header set Pragma "no-cache"
</VirtualHost>
#HTTPS config
<VirtualHost *:443>
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.pem
ServerName website.localhost
DocumentRoot /web/website
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /web/website>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /web/website/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /web/website/access.log combined
#turn off cache for development
Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
Header set Pragma "no-cache"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment