Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We run a web server and need to set up a new site in the same way you'd set up a virtualhost but just based on the IP address of the server rather than a domain name, eg so we can use:

http://134.243.21.2/blah/blah

which runs on a configuration in /etc/httpd/conf/sites/ just like any other vhost.

(note, fake IP address used!)

This vhost will have it's own set of restrictions (eg whitelist IP addresses) so it can't interfere with other vhosts on the same IP.

Is this possible? And if so, what's the core thing I should be looking out for.. maybe it's as simple as:

 HostName 134.243.21.2?
share|improve this question
    
Have you tried it? –  Ramhound May 9 '13 at 16:08
    
Whats the actual question here? Do you need help configuring Vhost? –  pal4life May 9 '13 at 17:34

1 Answer 1

At the top of the Vhost in your web configuration there's likely a line that says <VirtualHost *:80>. What that means is that connections to any IP ( the * ) on port 80 ( :80 ) go to this virtual host. What you need to do is you need to change that * to your current IP and also do it for the one that says *:443 if you have https enabled.

Then to add the new site, make a new VirtualHost (you can copy the current one and paste it down at the bottom, so you should have two port 80's and two port 443's) and change the * to whatever the new IP is, and edit your VirtualHost settings accordingly. That should give you two distinct sites, and just an fyi, you don't need two IP's, you can do VirtualHosts by the domain name, but I prefer to do it by IP personally.

Make sure that the IP is routed to the server, and that your server is set to accept it (normally through an eth0:0 interface if you don't have two real NICs)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.