Created
April 12, 2013 04:50
-
-
Save chales/5369476 to your computer and use it in GitHub Desktop.
Apache vhost - All traffic is redirected to SSL via redirect for port 80 to 443.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerName www.example.com | |
# Force secure access via redirect to https | |
RedirectMatch permanent /(.*) https://www.example.com/$1 | |
</VirtualHost> | |
# SSL | |
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
ServerAdmin [email protected] | |
ServerName www.example.com | |
DocumentRoot /var/www/example | |
<Directory /var/www/example/> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Order allow,deny | |
allow from all | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/ssl_example_error.log | |
# Values include: debug, info, notice, warn, error, crit, alert, emerg. | |
LogLevel debug | |
CustomLog ${APACHE_LOG_DIR}/ssl_example_access.log combined | |
# Enable/Disable SSL for this virtual host. | |
SSLEngine on | |
SSLCertificateFile /etc/ssl/example_com/example_com.crt | |
SSLCertificateKeyFile /etc/ssl/private/example.key | |
SSLCertificateChainFile /etc/ssl/example_com/example.ca-bundle | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory /usr/lib/cgi-bin> | |
SSLOptions +StdEnvVars | |
</Directory> | |
BrowserMatch "MSIE [2-6]" \ | |
nokeepalive ssl-unclean-shutdown \ | |
downgrade-1.0 force-response-1.0 | |
# MSIE 7 and newer should be able to use keepalive | |
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown | |
</VirtualHost> | |
</IfModule> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment