Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Setup Multiple Sites on Single IP Address

Status
Not open for further replies.

rabjac

Programmer
Sep 5, 2001
35
GB
Hi All,

I'm in a real fix at the moment. We have a web server configured and accessible (default test page is displayed) over the interenet.

What we want to do is have this web server service 6 domain names. Each of the domain names has a test and live site and all use the same ip address.

Is it possible to set-up Apache to allow this configuration. If so, can someone explain to me how to do it?

Many thanks for your time.

TIA,
Rab.
 
This is what worked for me...

Edit your /etc/httpd/conf/vhosts/Vhosts.conf file and create an entry for each domain. (If you don't have this, just put the entries in your httpd.conf file.)

The IP address should be the IP of that computer and also be in your /etc/hosts file.

Example:

NameVirtualHost 192.168.1.100

<VirtualHost 192.168.1.100>
ServerName ServerAlias domain1.com
DocumentRoot /var/ ErrorLog /var/log/httpd/domain2.error.log
TransferLog /var/log/httpd/domain2.access.log
</VirtualHost>

<VirtualHost 192.168.1.100>
ServerName ServerAlias domain2.com
DocumentRoot /var/ ErrorLog /var/log/httpd/domain2.error.log
TransferLog /var/log/httpd/domain2.access.log
</VirtualHost>


Paul Wesson, Programmer/Analyst
 
Not all distros use vhosts.conf. Most keep them in httpd.conf. I suggest putting them at the bottom so they are easier to edit.
 
Hi guys,

An update:

I've managed to get the website operational (locally) through SSL. The reason I know it's working locally:-

1. openssl_s_client -connect localhost:443 -state -debug
2. curl 3. curl
My issue now is that I cannot access the website through the correct url:-
Any ideas? The command curl works correctly but not the https version. I'm really stuck. I'm assuming that my certificate and key are correctly generated as I'm able to debug the 'localhost' version.

TIA,
Rab.
 
Is dns pointing to your ip? Are ports 80 and 443 open? If you have a firewall/router are you forwarding http and https traffic to your server?
 
I can ping and successfully receive replies for the correct ip address.

I can also do the following command:

openssl s_client -connect -state -debug

and successfully receive debug info.

I am therefore assuming that my firewall/dns and port 443 etc is set-up correctly.
 
If you need ssl, you can only have one ip per ssl site. Look up &quot;ip based virtual hosts&quot; vs &quot;named virtual hosts&quot;.
Because of the nature of ssl, you can only have one ssl site per ip address. You can listen on port 80 and rewrite/redirect all traffic to port 443. But you'll need to breakk out all ssl sites to their own ip address. There may be some other wild solutions to this.

Also, the security certificate authority will also require one certificate per site.

Does this help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top