Results 1 to 1 of 1
Hello all. I just got finished banging my head against Apache documentation, forum posts, and my monitor and here is what I've come up with (and confirmed as working)
Debian ...
- 09-20-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 1
Apache2 on Debian
Hello all. I just got finished banging my head against Apache documentation, forum posts, and my monitor and here is what I've come up with (and confirmed as working)
Debian by default uses a2ensite/a2dissite to link Virtual Host files (you create) in the /etc/apache2/sites-available to /etc/apache2/sites-enabled. This is fine if you have one site or even two (and are really careful). But if you, like me, host many sites off the same IP address, then you will find the following information very helpful. By the way, if I am wrong, PLEASE tell me.
at the end of /etc/apache2/apache2.conf there is an Include /etc/apache2/sites-enabled directive. Comment this out and replace it with Include /etc/apache2/vhosts.conf
now, with your favorite editor create a file /etc/apache2/vhosts.conf.
In this file, the first line will be NamedVirtualHost <Some IP you have> where <Some IP you have> is an actual interface's IP address (if you are NATing, use your internal address).
the following lines should follow the normal VirtualHost Directives like:
The ErrorLog and CustomLog directives make mgmt easier and you will also add any other directives in the vhosts.confCode:NameVirtualHost 192.168.254.4:80 NameVirtualHost 192.268.254.4:443 #################### Start SomeSite.com Vhost ##################### <VirtualHost 192.168.254.4:80> DocumentRoot /var/www/SomeSite ServerName SomeSite.com ServerAlias www.SomeSite.com ErrorLog /var/log/apache/SomeSite.com-error.log CustomLog /var/log/apache/SomeSite.com-access.log combined Options FollowSymLinks MultiViews </VirtualHost> #################### End SomeSite.com Vhost ######################## #################### Start SomeOtherSite.com (SSL) Vhost ##################### <VirtualHost 192.168.254.4:80> DocumentRoot /var/www/SomeOtherSite ServerName SomeOtherSite.com ServerAlias www.SomeOtherSite.com ErrorLog /var/log/apache/SomeOtherSite.com-error.log CustomLog /var/log/apache/SomeOtherSite.com-access.log combined Options FollowSymLinks MultiViews </VirtualHost> <VirtualHost 192.168.254.4:443> DocumentRoot /var/www/SomeOtherSite ServerName SomeOtherSite.com ServerAlias www.SomeOtherSite.com ErrorLog /var/log/apache/SomeOtherSite.com-error.log CustomLog /var/log/apache/SomeOtherSite.com-access.log combined Options FollowSymLinks MultiViews SSLEngine On SSLCertificateFile /path/to/your/file.crt #Public Key SSLCertificateKeyFile /path/to/your/file.key #Server Key SSLCertificateChainFile /path/to/your/intermediateFile.crt #Intermediate </VirtualHost> #################### End SomeOtherSite.com Vhost ########################
I hope this helps... please feel free to comment and complain.


Reply With Quote
