# How to enable multiple secure vhosts on the same IP, port and domain.
#
# 0) All hosts on the same IP must use the same wildcard SSL certificate.
#
# 1) Without the port number on the ServerName users would randomly see a
# "12263 error" over SSL. To be safe I added it on all vhosts.
#
# 2) With PHP - if you want to use Environment Vars from $_SERVER, you might
# have to set them yourself. Apache lies to PHP when on SSL.
#
# 3) Only enable SSL once per Cert
#
# Enable name based hosts for the IP and ports you plan to use
NameVirtualHost 192.168.0.2:80
NameVirtualHost 192.168.0.2:443
# WWW.EXAMPLE.COM
ServerName www.example.com:80
DocumentRoot "/var/www/example.com/www"
# SECURE WWW.EXAMPLE.COM
# Without the port number on the ServerName users would randomly see a "12263 error"
ServerName www.example.com:443
DocumentRoot "/var/www/example.com/www"
# Enable SSL (only once per cert)
SSLEngine on
SSLCertificateFile /var/ssl/example.com/STAR_moneydesktop_com.crt
SSLCertificateKeyFile /var/ssl/example.com/STAR_moneydesktop_com.key
SSLCACertificateFile /var/ssl/example.com/STAR_moneydesktop_com.gd_bundle.crt
# Apache lies to PHP about these environtment variables
# Despite the browser being happy on https (443)
# 'HTTPS' isn't set in the PHP $_SERVER array and 'SERVER_PORT' is set to 80
SetEnv HTTPS on
SetEnv SERVER_PORT 443
# ADMIN.EXAMPLE.COM REDIRECT
ServerName example.com:80
redirect permanent / https://admin.example.com/
# SECURE ADMIN.EXAMPLE.COM
# Without the port number on the ServerName users would randomly see a "12263 error"
ServerName admin.example.com:443
DocumentRoot "/var/www/admin_example.com/www"
# DO NOT turn the SSL Engine on or configure the SSL Certs, it is already done
# Apache lies to PHP about these environtment variables
# Despite the browser being happy on https (443)
# 'HTTPS' isn't set in the PHP $_SERVER array and 'SERVER_PORT' is set to 80
SetEnv HTTPS on
SetEnv SERVER_PORT 443