Results 1 to 5 of 5
hi! just new to linux(RH9) so pls help...
these are the lines in my httpd.conf:
Listen *.80
NameVirtualHost 192.168.0.183
<VirtualHost 192.168.0.183>
DocumentRoot /home/user1
ServerAdmin admin@mail.com
ServerName user1
</VirtualHost>
note: the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-02-2003 #1Just Joined!
- Join Date
- Sep 2003
- Location
- Philippines
- Posts
- 10
apache virtual host for local testing
hi! just new to linux(RH9) so pls help...
these are the lines in my httpd.conf:
Listen *.80
NameVirtualHost 192.168.0.183
<VirtualHost 192.168.0.183>
DocumentRoot /home/user1
ServerAdmin admin@mail.com
ServerName user1
</VirtualHost>
note: the IP address supplied above is what i get from "#/sbin/ifconfig -a". i used 127.0.0.1 alternately
but everytime i access http://user1 then it's looking for http://www.user1.com. how can i set i t up so that it will serve my /home/user1 folder? just for local testing
- 09-02-2003 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
You can't just set the ServerName directive and hope that it will work. The browser must also be able to resolve the name to an IP address.
- 09-03-2003 #3Just Joined!
- Join Date
- Sep 2003
- Location
- Philippines
- Posts
- 10
ok. thanks for the reply!
but could somebody tell what i am missing or what i am doing wrong? (except of course the reason that i'm just so dumb or too lazy, maybe...
)
anyway, is it valid to use user1 as ServerName? looking at the apache manual, all the supplied example there use www.blahblah.com or blahblah.com. but i just intend to work on this locally, so i think i don't have to use the www/.com. the default ServerName is localhost, so i assume that it is also valid to use user1 or any on a virtual host.
anyway, using www.user1.com as the ServerName doesn't work either... so how could i make the browser resolve the name of the IP address?
- 09-03-2003 #4Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
That depends... do you want to make this work on your entire LAN, or just on the local computer? If you just want it to work on the local computer, you can just add the following line to /etc/hosts:
If you want to make it work on the entire LAN, you must either do the same on every computer, or you must use some way to dstribute it, such as setting up a DNS server.Code:192.168.0.183 user1
The thing is that the browser must be made to know what address to connect to, and apache cannot tell it directly. /etc/hosts is one way of mapping symbolic hostnames onto IP addresses. DNS in another, although much more difficult to set up.
- 09-03-2003 #5Just Joined!
- Join Date
- Sep 2003
- Location
- Philippines
- Posts
- 10
thanks a lot, Dolda! you're great...
i think i got all i need to know. at least, i have some topics to delve onto for now. you're right, i'm planning to set it up as the server for the entire LAN here. but for now, i'm testing it here on my machine
i'll try the DNS way...


Reply With Quote
