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 😮
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>
Best Answer
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.