Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Servers > apache virtual host for local testing

Forgot Password?
 Servers   Anything server related, Apache, MySQL, Samba, server security, sendmail, exim, etc

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 09-02-2003   #1 (permalink)
Just Joined!
 
Join Date: Sep 2003
Location: Philippines
Posts: 10
Send a message via Yahoo to tr3s
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
tr3s is offline  



Reply With Quote
Old 09-02-2003   #2 (permalink)
Linux 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.
Dolda2000 is offline   Reply With Quote
Old 09-03-2003   #3 (permalink)
Just Joined!
 
Join Date: Sep 2003
Location: Philippines
Posts: 10
Send a message via Yahoo to tr3s
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?
tr3s is offline   Reply With Quote
Old 09-03-2003   #4 (permalink)
Linux 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:
Code:
192.168.0.183    user1
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.

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.
Dolda2000 is offline   Reply With Quote
Old 09-03-2003   #5 (permalink)
Just Joined!
 
Join Date: Sep 2003
Location: Philippines
Posts: 10
Send a message via Yahoo to tr3s
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...
tr3s is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.
subscribe
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 10:52 PM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1