Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have spent all weekend to replicate my development server back at home. I have an Apache server with 3 IP based virtual hosts pointing to

1.2.3.4 /var/www/www.a.com
1.2.3.5 /var/www/www.b.com
1.2.3.6 /var/www/www.c.com

Now I have been able to set up a VM on my desktop, installed the OS, the applications, the db server, apache etc. Everything is looking good so far.

So right now I have,

192.168.0.111 at /var/www/www.a.com
192.168.0.112 at /var/www/www.b.com
192.168.0.113 at /var/www/www.c.com

So when I go to 192.168.0.111, I go to www.a.com so I guess apache is working aswell.

What I want to do is, instead of going to www.a.com I want to change it to another address such as a.me.add1

How can I do this? I am looking through the virtual hosts section, I have changed server name entry etc but its not working.

Can you tell me in big picture what I would need to do to set that up? My current set up doesnt really help me much once the site get the www address.

Sorry if I am not explaining it right. I can provide my conf files if you need them. I have webmin installed.

Or could you tell if Document Root of IP address 192.168.0.111 points to /var/www/www.a.com, will it always resolve into that webaddress. That is if I enter 192.168.0.111 the browser will redirect it to www.a.com. What effect does Server Name has in this regard then?

share|improve this question
    
Have you restarted apache? –  dmah Dec 13 '10 at 2:14
    
Yes. When I do enter my local IP, I go to the www.a.com I would like it to go to another address such as a.me.1 etc so that I am browsing local website. The actual site www.a.com is accessible from internet –  bcrawl Dec 13 '10 at 2:22
    
Are you entering the URL by IP address or by hostname? Do you have the IP address you entered mapped locally in /etc/hosts to www.a.com? –  dmah Dec 13 '10 at 2:31
    
I am entering URL by IP. It gets resolved into hostname. No, I have not made any changes to /etc/hosts file. –  bcrawl Dec 13 '10 at 2:35
    
How is your IP getting resolved into a hostname? Your 192.168.0.111 address shouldn't be routeable to the Internet. What do your Apache error logs from www.a.com and a.me.1 say? –  dmah Dec 13 '10 at 2:43
show 2 more comments

1 Answer 1

Are you wanting the url in the client browser to change depending on the IP you type in? Or are you wanting a different site to load with a different IP?

If you want a IP or a domain name to go to a specific site use /etc/apache2/sites-enabled. Add a file to this directory with the contents;

<VirtualHost *:80>
        DocumentRoot /var/www/whatever
        ServerName a.me.add1
</VirtualHost>

Then restart apache (/etc/init.d/apache2 restart)

Make sure the domain name resolves to the correct IP address (edit your dns records)

If I understand you correctly this should do what you want...

share|improve this answer
add comment

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.