LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-18-2008, 04:51 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Rep: Reputation: 69
I got a question about configuring my web server


the default location for the index.html on fedora 8 is
/var/www/html/ on which port 80 is listening

Can I configure another index.html listening on another port, say 8080? How would I do that? Would that index.html still be in /var/www/html/?
What would i have to change?

I know I'd have to edit the Listen port on httpd.conf, but can I have two separate web servers (webpages) listening on two different ports? I know that if someone wanted to access the one on port 8080 they'd just append :8080 after the domain name. But what do I need to change to have two web servers running on the same computer?
 
Old 05-18-2008, 05:09 PM   #2
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
What you want is to set up virtual hosting on your webserver. There is a separate section in the Apache documentation that describes how to do this. Boiled down, you need to make 3 changes to what you now have (assuming that you are not yet doing virtual hosting).
1. Create a <VirtualHost> container for your current website. You might want to move the pages to a subfolder, say /var/www/html/bar. This container should specify port 80.
2. Create a <VirtualHost> container for your new stuff. It should probably be in a different folder (mine are all of the form /var/www/html/foo. This container should specify port 8080
3. Edit your httpd.conf file (maybe in /etc/httpd/conf/httpd.conf), so that it not only listens on the standard port (80), but also on your special port:
Code:
Listen 80
Listen 8080
.

As an alternative to this, you can use Name-Based Virtual Hosting; in this scheme, you need to have a way of allowing users to map different DNS names to your IP address; then the Apache server matches the name in the request against the VirtualHost ServerName. If your users are on the public Internet, this means registering a second DNS name that resolves to the same IP address as your first site name. If your users are only on a private net, then you can set up a private DNS server that will supply the correct name-to-address resolution for those users.
 
Old 05-18-2008, 06:30 PM   #3
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
but how does httpd now which webpage is tied to 8080 and which is tied to 80?

I mean if I have one on
/var/www/html/foo/index.htm

and another on
/var/www/html/bar/index.htm

How will httpd know which one is for port 80 and which one is for port 8080?

Also, won't httpd be looking for the index.htm in
/var/www/html/ instead of /var/www/html/foo ?

I was looking at httpd.conf and I'd have to modify

Listen 80
I would add another line
"Listen 8080"

ServerName 192.168.1.131:80
I would add another linke
ServerName 192.168.1.131:8080

DocumentRoot
/var/www/html/
I would edit this by replacing it with two lines
/var/www/html/foo/
/var/www/html/bar/

But still, how would httpd.conf know which is for which port?
 
Old 05-19-2008, 02:08 AM   #4
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
I realize this may be daunting when you first set out, but you really should Read The Fine Manual. There is a thorough discussion of all this here

Once you define the first <VirtualHost> container, one of the first things that you will need to put inside each one is a configuration line that says
Code:
DocumentRoot /var/www/html/foo
and in the second <VirtualHost> container, a configuration line that says
Code:
DocumentRoot /var/www/html/bar
These differing document roots will tell the server that when it receives a request that matches the specifications for the first <VirtualHost> definition, it should begin looking for files in /var/www/html/foo, but if it receives a request that matches the specifications for the second <VirtualHost> definition, it should begin looking for files in /var/www/html/bar.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuring Web Server for my IP address samcomm Linux - Networking 2 03-17-2006 01:37 PM
Configuring my web server with APACHE pkrishna10 Linux - Newbie 2 12-11-2004 07:44 AM
Configuring Network For Web Server 3333 Linux - Networking 5 10-04-2004 10:54 PM
configuring the web server harun_acs Linux - Networking 2 07-05-2004 02:26 PM
Configuring web and mail server...HELP! Markv Linux - Newbie 9 01-11-2004 06:37 PM


All times are GMT -5. The time now is 07:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration