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've just setup a development server. I did 2 apache virtualhost, using 2 different domains from noip.com.

The weird thing is, I had to add both in the etc/hosts file, wich I never had to in the past when I configured other vps :o

I never had to edit that file in the past, I had to edit it so both of my domain point to my vps's ip. Before editing it, I only had 1 of the two pointing to it (the hostname I entered when I oredered my vps).

Is it because I don't run my own DNS server?

Now everything work A1, but If someone could tell me why I have to play with etc/hosts, I would appreciate it.

EDIT

etc/hosts

::1 localhost.localdomain localhost
127.0.0.1 localhost.localdomain localhost

173.212.221.26 brico.no-ip.org  brico


173.212.221.26 brico-redmine.no-ip.org  brico-redmine

apache2ctl -S

root@brico:~# apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server brico.no-ip.org (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost brico.no-ip.org (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost brico-redmine.no-ip.org (/etc/apache2/sites-enabled/redmine:1)
Syntax OK

brico-redmine.no-ip.org virtualhost file

<VirtualHost *:80>
    DocumentRoot /opt/redmine/public
    ServerName brico-redmine.no-ip.org
    PassengerPoolIdleTime 0
        <Directory "/opt/redmine/public">
                PassengerEnabled on
                AllowOverride
                Options -MultiViews
        </Directory>
</VirtualHost>
share|improve this question
    
What exactly did you put in your hosts file? And is the apache server hosted at some datacenter, or on your private LAN? –  Martijn Heemels Sep 12 '10 at 15:49
    
some datacenter, but they dont offer DNS server, I would have to install one myself. But Instead, I just used a free dns service (noip) –  allaire Sep 12 '10 at 15:57
    
Please edit your question and paste it there, instead of a remote service such as pastie.org. That way people don't have to leave the page, and your question will not depend on another service's function. –  Martijn Heemels Sep 12 '10 at 15:58

1 Answer 1

up vote 1 down vote accepted

Your browser has to figure out which IP address a hostname points to. It can do this via the hosts file, via a private DNS server, or via a public DNS server.

Since you already registered two noip.com hostnames you shouldn't need those lines in your hosts file. You effectively have a public dns server, although a simple one.

Just make sure your Apache virtualhosts are configured to respond to the right ServerName. One should respond to brico.no-ip.org and the other to brico-redmine.no-ip.org. Remove both those lines from your hosts file, otherwise it will take precedence.

If you also want to be able to just use the words brico and brico-redmine in your browser, you'll need to add no-ip.org to the search-domain in your dns-client settings. Let us know which client OS you use, if you want specific advice.

share|improve this answer
    
hey, thanks for your help so far. it's weird because I have both ServerName different in both virtualhost, and it wasn't working :o I'm on ubuntu 10.04 –  allaire Sep 12 '10 at 16:06
    
If you could show your virtualhost config we could probably find the cause. Run 'apache2ctl -S' from the command-line. –  Martijn Heemels Sep 12 '10 at 16:12
    
OK just added to the bottom of my post –  allaire Sep 12 '10 at 16:34
    
I've also added the content of my brico-redmine.no-ip.org virtualhost file! –  allaire Sep 12 '10 at 16:37
    
Got it working, I just rebooted the VPS, removed all the lines my /etc/hosts, and voilà! thanks a lot for your help –  allaire Sep 12 '10 at 16:47

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.