Hi all, 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>
-
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.
all-R : 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.04Martijn Heemels : If you could show your virtualhost config we could probably find the cause. Run 'apache2ctl -S' from the command-line.all-R : OK just added to the bottom of my postall-R : I've also added the content of my brico-redmine.no-ip.org virtualhost file!all-R : Got it working, I just rebooted the VPS, removed all the lines my /etc/hosts, and voilĂ ! thanks a lot for your helpMartijn Heemels : Your vhost config looks fine. If the IP address in your no-ip.org dns is still correct it looks like it should work, even without the hosts file. Ah, I missed your update. Glad that it works.all-R : Do you think there is a better way to manage the different part of my website without using no-ip addresses? like I dont know having 173.212.221.26 for my main website, and 173.212.221.26/redmine for the redmine part. Because I tried and it didn't work, so I had to use hostname for both. and I guess I can't have redmine.brico.no-ip.org ... mehMartijn Heemels : Subdirectories should work, but depending on the software you want to run. I prefer to separate them via hostnames though. You could register your own domain and have all the flexibility you need via DNS. It's quite cheap, and not hard at all. Take a look at http://www.gandi.net/domain who have reasonable prices and a good DNS GUI.all-R : But then I would need to roll my own DNS Server?Martijn Heemels : Most registrars provide free DNS hosting for the domains you purchase through them. I use Gandi's DNS for my personal domains, and they have both an easy and advanced interface depending on your experience level, which is why I recommended them for your case.From Martijn Heemels
0 comments:
Post a Comment