Thursday, January 17, 2013

Adding multiple ssl virtual hosting

For this we need to add another ip to the machine.

/etc/network/interfaces

auto eth0:1
iface eth0:1 inet static
address 192.168.1.122
netmask 255.255.255.0

/etc/init.d/networking restart
Check ipconfig -a

/etc/apache2/ports.conf
NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.

    Listen 192.168.1.121:443
    Listen 192.168.1.122:443
    NameVirtualHost 192.168.1.121:443
    NameVirtualHost 192.168.1.122:443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

vi /etc/apache2/sites-enabled/000-default-ssl
<Directory /var/www>
 Options +ExecCGI Indexes FollowSymLinks MultiViews
 AddHandler cgi-script cgi pl
 AllowOverride Limit
 DirectoryIndex index.cgi
 Order allow,deny
 allow from all
</Directory>

No comments:

Post a Comment