Solved

Virtual Hosting

Posted on 2000-02-29
10
372 Views
Last Modified: 2013-12-05
what is virtual hosting?

I want to administrate 2 web sites in only one apache server, how to do it?
0
Comment
Question by:mwhuen
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 1

Expert Comment

by:hansendc
ID: 2569997
It takes a little bit more than can be explained here.  Have you even LOOKED at the Apache documentation?  It isn't an exceedingly difficult thing to do.  

Look at these docs:
http://www.apache.org/docs/vhosts/index.html
0
 
LVL 2

Expert Comment

by:EatEmAndSmile
ID: 2570103
It is quite simple. First you must assure that both web addresses point to your Apache's IP address. Then there are a few options to tweak in /usr/local/apache/conf/httpd.conf

 As our friend above said, it's not difficult to do it.
0
 
LVL 12

Expert Comment

by:j2
ID: 2570301
Eat: your suggested path is not correct for Debian, Redhat, SuSE, TurboLinux, Bestlinux. (Adn dont give me the "It is not my fault if they use a 'broken' distribution and they should all change to slackware") ;)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:hansendc
ID: 2570310
Where do all the other distros put it?
0
 
LVL 12

Expert Comment

by:j2
ID: 2570426
RH / mandrake / SuSE uses

/etc/httpd/conf/httpd.conf and srm.conf for vhosting (and of cource access.conf)

not to sure about the others, but it is under the /etc structure.
0
 
LVL 17

Expert Comment

by:psimation
ID: 2571697
j2 , Eat is 100% correct about the path; provided that he mentioned that he installed his own apache server, and not selected to install apache during installation of the OS. This way is also in my view the best route to follow, for one reason alone, installing frontpage server extensions on your web is near impossible if you use apache from the OS install.
mwhuen, as others have mentioned, it is not "as" easy as some might suggest, there are a couple of things you need to do first. You need a static IP for your server box. (not just any IP you can think of, this IP must be unique on the internet) If you have such an IP, then you need a name server as well. The name server must then point any requests for webpages you want to host on your pc, to your pc's IP. For instance, if you want to host two pages www.1.com, and www.2.com, both need to point to the same IP. On your webserver box, you will then need to edit the httpd.conf file. If you install your own apache, it will be at /usr/local/apache/conf/httpd.conf, if it was installed with the OS, it will be in /etc/httpd/conf/httpd.conf
Don't edit the other *.conf files, you only need to edit the httpd.conf file.
You will add the virtual hosts right at the bottom of that file ( there will already be a sample of a virtual host, you just need to change it to match your needs). You will also need to ensure that the rest of the file is correct, eg. server name, and you should also add NameVirtualHost xxx.xxx.xxx.xxx :80
where xxx = your IP.
Then you will also need to ensure that the permisiions of your web files are set so that it can be accessed from outside, therefore, make it writeable to the owner of the web only, and all the other permissions can be set active.
0
 
LVL 2

Expert Comment

by:EatEmAndSmile
ID: 2572529
hansendc: I really don't know how many Linux distributions are there today, as I've found my favourite distribution already. Slackware puts it in /usr/local/apache, the place suggested by nobody else than the Apache developing team. Should we argue with them? :)

j2: As I'm developing e-commerce applications based on MySQL + PHP3 + Apache, I had to build Apache myself with support for these tools. As a good admin, I've installed Apache in the recommended path, that is /usr/local/apache. That is no surprise to me, as a good distribution like Slackware already puts it there. Also, srm.conf is deprecated (if you've ever built your own Apache, you'll see the message left by the Apache developing team in this same file) so you should find all configuration parameters inside /usr/local/apache/conf/httpd.conf.

psimation: I've forgot about those details! I mean, the real IP thing and DNS. I thought that was already well-known. Thanks!
0
 

Author Comment

by:mwhuen
ID: 2573470
Thanks for all you guys,
I learnt much in this question.
psimation said I need a name server as well,
can you guys give more information about it?

does linux include name server? how to configure it?
0
 
LVL 2

Expert Comment

by:EatEmAndSmile
ID: 2573536
Yes, named is the DNS server (name server) that comes with the BIND package. It's configured in /etc/named.conf. Configuring it is quite simple and you should have no trouble doing it as long as you have some free time to carefully read the DNS-HOWTO file included in your /usr/doc/Linux-HOWTOs directory. It won't take more than a few hours if you do it slowly and patiently.

 The DNS server is responsible for telling everybody who's holding the web addresses you plan on hosting. Just like: "Hey!! I'm the owner of www.mwhuen.com!!"

 Hope this get you where you want.

 Good luck!
0
 
LVL 1

Accepted Solution

by:
Sokka earned 10 total points
ID: 2576019
1. Make sure U have apache server installed in Ur PC

2. Then U will have a directory like /usr/local/apache or /usr/bin/apache

3. Go to that drectory

4. U can see a file called as httpd.conf

5. Opne the file

6. U can see the virtual hosting systax...

7. Remove the comment and give the virtual hosting of any number of domains

8. restart apache server

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question