Page 1 of 1

Hosting Multiple Namebased VirtualHosts with SSL

PostPosted: 24. September 2004 09:20
by fusibal
HOW TO USE XAMPP TO HOST MULTIPLE DOMAINS, ALOWING ALL THE DOMAINS TO HAVE BOTH NON-SSL(http://...) AND SSL(https://...) CAPABILITY?
For the past several days, I've been trying to host multiple name based vhosts using xampp. No one was any help. I read almost the entire apache 2.0 docs, and openSSL, mod_SSL docs. Finally, I succeeded ... I must have re-written the whole httpd.conf and ssl.conf files over 10x. I hope all the pain I went through will help you save time.
Just add the below to the end of your httpd.conf file as needed and it should work. You can just keep adding VirtualHosts with different ServerName and DocumentRoot directives.

-----------------add to http.conf---------------------------
# Use name-based virtual hosting, add your own ip,
# find your IP by going to start>run>cmd and type ipconfig /all.
NameVirtualHost 192.168..0.1:80
NameVirtualHost 192.168.0.1:443

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.

###### DOMAIN1 non SSL ###########
<VirtualHost 192.168.0.1:80>
DocumentRoot "C:/xampp/htdocs/path2domain1"
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com

# If you need domain specific Error or access logs
# ErrorLog logs/domain1_error.log
# CustomLog logs/domain1_access.log common
</VirtualHost>

### SSL FOR THE SAME DOMAIN1 ####
<VirtualHost 192.168.0.1:443>
# General setup for the virtual host
DocumentRoot "C:/xampp/htdocs/_test/catalog"
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
ServerAdmin you@your.address

#If you need domain/SSL specific error and access logs
ErrorLog logs/domain1_sslerror.log
TransferLog logs/domain1_sslaccess.log
#SSL Engine Switch (on|off):
SSLEngine on
# Server Certificate:
SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
# Server Private Key:
SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
# Below <Directory> only needed if you want to secure a directory with user
# authentication. Change options as needed.
# Read http://httpd.apache.org/docs-2.0/howto/auth.html
# <Directory "C:/xampp/htdocs/path2domain1">
# AuthType Basic
# AuthName "Restricted Stuff here"
# AuthUserFile "C:/xampp/apache/bin/passwd/passwords
# Require user yourNameHere
# </Directory>
</VirtualHost>
--------------------------THE END----------------------

Hope this helps ... if so, write a quick thank you note below! pass on your knowlege. Give and ye shall receive.

Oops

PostPosted: 24. September 2004 09:38
by fusibal
As you add additional VirtualHosts, the only directives you need to change in each are:
DocumentRoot
ServerName

You don't need any of the other directives for it to work, but you can use them to set things like alias names for your domain, specific log files .... etc.

:wink:

PostPosted: 24. September 2004 11:25
by Kristian Marcroft
Hi,

I just made it sticky...
Next time just edit your old post if you find an error.

So long
KriS

PostPosted: 25. September 2004 19:46
by fusibal
Ok. Thank you KriS.
I didn't know I could edit ... Now I do. :D
How did you like the http.conf directives for hosting multiple domains with both nonSSL & SSL capabilities? If there is a better/easier way, let me know.

Also, everyone reading this topic, pleast vote ... let me know if a quick howto for this topic would be useful.

GREAT- yes, please, How2

PostPosted: 26. September 2004 07:07
by chanio
fusibal wrote: ... let me know if a quick howto for this topic would be useful.

:lol:
Please, see the manual link. It's empty.

What increases the value of every distribution is the number of HOW-2s that it has. So, if you appreciate this XAMPP one, please, don't doubt of filling it all with your nice How-2s.

Who, knows, perhaps they become included as the docs for next releases.
Besides, it would be the only one written with good English. Translations don't help much, though.

I have been trying to make my own SSL since WAMPP's first release. With your help, may be I'll succeed in some short time...

TXS, fusibal!