Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If its purely for internal consumption, you can call it anything you like, although you'll need an equiv entry in /etc/hosts so the browser can find it, or a local DNS server.
Personally, like the fact that you should only use private ip ranges for this eg 192.168.x.x I (and others) also create fictitious domain names, so it's obvious if it escapes onto the internet it will get dropped instead of ending up at a real (not yours) website.
eg
site1.domain.cxm # note cxm is not a valid tld on the web.
YMMV
If this is for work (even if its only internal), you should get a proper name.
First thing with hosting a virtual host, if you are using multiple different domain names, if I remember right you have to uncomment the following line in the httpd.conf file, I can't remember this for certain if it's this line, there is certainly one line it has to be done but from memory it should look like the following.
#NameVirtualHost *:80
Just delete the #, you may possible want to change the listen port if it's not going to be port 80. After this you then you set up your virtual host something like the following substituting the <> for what ever needs to go there
Code:
<VirtualHost *:80>
DocumentRoot <directory in file system where site is>
ServerName <main domain ie example.com>
ServerAlias <alternative domains ie www.example.com example2.com>
</VirtualHost>
if you want it to listen on a specific IP change the *:80 to the ip:80 ie 127.0.0.1:80
Last edited by r3sistance; 10-09-2009 at 02:10 AM.
If the host uses a local-only IP (like 192.168.*.*), the server will be limited to intranet use -- I think this is what you want.
You can create as many such virtual servers as you like, each with a different access port. This method using different access ports is by far the simplest way to create virtual servers, which explains why it's used so often.
The other method i cant get my head round, cause even if i had a dns entry for penguin = 10.101.22.254 then had penguin2 = 10.101.22.254 how could that work?
Even though both the VirtualHost containers are using the same IP address (NameBased VirtualHosting), Apache web server checks the Hostname/domain name in the HTTP header and shows the loads/parses the corresponding index page from the respective VirtualHost DocumentRoot.
You can check the following documentation page for better understanding and more information,
have you read the apache docs for this .i found them VERY helpful 6 years ago when i set up my first server
and still do use them . http://httpd.apache.org/docs/2.2/vhosts/
That's why I mentioned that darned line before, nothing more fun then having to hunt through documents just to find you need that line uncommented and active! Gotta love reading all the way through such a large file as the httpd.conf
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.