Tag Archives: httpd

HTTPS/HTTP Virtual Hosts

 

Sometimes there is a need to have vitual hosts (vhosts,Name-based virtual hosts) wikipedia

To enable https vhosts, use this example in /etc/apache2/vhosts.d/00_default_ssl_vhost.conf:

NameVirtualHost *:443

<VirtualHost *:443>
 SSLEngine on
 SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
 SSLCertificateFile /path/to/your/cert.crt
 SSLCertificateKeyFile /path/to/your/cert.key

 ServerName vhost1.cdstealer.com
 SSLOptions StrictRequire
 SSLProtocol all -SSLv2

 DocumentRoot /path/to/your/htdocs/vhost
 <Directory /path/to/your/htdocs/vhost>
 SSLRequireSSL
 Order Deny,Allow
 Allow from All
 </Directory>

 <IfModule log_config_module>
 TransferLog /var/log/apache2/ssl_access_log
 </IfModule>

</VirtualHost>

To enable http vhosts, use this example in /etc/apache2/vhosts.d/00_default_vhost.conf:

NameVirtualHost *:80

<VirtualHost *:80>
 ServerName vhost1.cdstealer.com
 DocumentRoot /path/to/your/htdocs/vhost/
 <Directory /path/to/your/htdocs/vhost/>
 Allow from All
 </Directory>
 <IfModule mpm_peruser_module>
 ServerEnvironment apache apache
 </IfModule>
</VirtualHost>

However, doing this won't be enough.  Your DNS host will also need a CNAME  to point to your server.