Virtual Host
How to create an Apache HTTP Virtual Host
- You must first Install and Configure Apache HTTP Server
See our Apache HTTP Server documentation - You must also install and configure the mod_ssl Apache module
See our Apache mod_ssl documentation - Create/Open the file /etc/httpd/conf.d/$domain.conf with the following text replacing variables where necessary
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
ServerAdmin $webmaster_email
DocumentRoot /var/www/html/$domain
ServerName www.$domain
ServerAlias $domain# Logging
ErrorLog logs/$domain-error_log
CustomLog logs/$domain-access_log common
</VirtualHost> - Restart the Apache HTTP Server daemon
service httpd restart
How to create an Apache HTTPS Virtual Host
- You must first Install and Configure Apache HTTP Server
See our Apache HTTP Server documentation - You must also install and configure the mod_ssl Apache module
See our Apache mod_ssl documentation - Create/Open the file /etc/httpd/conf.d/$domain.conf with the following text replacing variables where necessary
# $domain HTTPS Virtual Host
<VirtualHost *:443>
# General
ServerAdmin $webmaster_email
DocumentRoot /var/www/html/$domain
ServerName www.$domain
ServerAlias $domain# Logging
ErrorLog logs/$domain-ssl_error_log
TransferLog logs/$domain-ssl_access_log
CustomLog logs/$domain-ssl_request_log “%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \”%r\” %b”
LogLevel warn# SSL Engine
SSLEngine on# SSL Protocol
SSLProtocol all -SSLv2# SSL Cipher Suite
SSLCipherSuite LL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW# Server Certificate
SSLCertificateFile /etc/pki/CA/certs/$domain.crt# Server Private Key
SSLCertificateKeyFile /etc/pki/CA/private/$domain.key# SSL Engine Options
<Files ~ “\.(cgi|shtml|phtml|php3?)$”>
SSLOptions +StdEnvVars
</Files>
<Directory “/var/www/cgi-bin”>
SSLOptions +StdEnvVars
</Directory># SSL Protocol Adjustments:
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown owngrade-1.0 force-response-1.0
</VirtualHost> - Restart the Apache HTTP Server daemon
service httpd restart
Note: See our OpenSSL documentation for creating test certificates