Question : Apache2 name-based virtual host & SSL


I would like to run two applications on one machine, but I want users to type https://www.app1.webapps.com
and https://www.app2.webapps.com.
Is it possible to have named-based vhosts (app1 and app2) on apache2 + ssl wildcard certificate?

Please help me, I will greatly appreciate it.

Thanks in advance

Abdellah

Answer : Apache2 name-based virtual host & SSL

Hi,

I have striped parts of this out to help show you what you need to do. Taken this from here (http://www.debian-administration.org/articles/412) but the config is relatively the same.

1. Create the directory structures.
   mkdir /var/www/html/

   mkdir /var/www/html/app1
   mkdir /var/www/html/app1/htdocs
   mkdir /var/www/html/app1/logs

   mkdir /var/www/html/app2
   mkdir /var/www/html/app2/htdocs
   mkdir /var/www/html/app2/logs

      or c:\your\web\folders.


2. Modify httpd.conf configuration

 NameVirtualHost *

#
#  app1.com (/var/www/html/app1)
#
<VirtualHost *>
        ServerAdmin [email protected]
        ServerName  www.app1.webapps.com
        ServerAlias app1.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /var/www/html/app1/htdocs/

        # Logfiles
        ErrorLog  /var/www/html/app1/logs/error.log
        CustomLog /var/www/html/app1/logs/access.log combined
</VirtualHost>

#
#  app2.com (/var/www/html/app2)
#
<VirtualHost *>
        ServerAdmin [email protected]
        ServerName  www.app2.webapps.com
        ServerAlias app2.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /var/www/html/app2/htdocs/

        # Logfiles
        ErrorLog  /var/www/html/app2/logs/error.log
        CustomLog /var/www/html/app2/logs/access.log combined
</VirtualHost>

3. Restart Apache.

As the other have mentioned, you should have your DNS setup as well to send requests to the webserver.

For SSL, you just need to enable it on the httpd.conf and create a certificate. Let's first get your sites up and then focus on SSL.

Cheers,
Hades666
Random Solutions  
 
programming4us programming4us