LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-20-2004, 09:05 AM   #1
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Rep: Reputation: 30
Exclamation DNS and Webserver help


Is it possible to have two web sites running off your fc3 box with one ip? For example

www.mysite_1.com


www.mysite_2.com


have them set up to


/home/test/site1

/home/test/site2

and have it so that if someone comes from www.mysite_1.com it will send them to mysite_1.com, and vise versa for www.mysite_2.com?

Second- in FC2 there is a dns server config tool, however in fc3 i cant seem to find it? was this replaced by something or is there a better way to set up dns on your linux box?

thanks
 
Old 11-20-2004, 10:38 AM   #2
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 35
You can do 1 of two things. You simply create virtual hosts in apache. They can be done on a name base or ip based.

ip based would simply require you to create virtual IP addresses.

if eth0 is 192.168.0.1
you can make etho:0 be a completely different ip and both will point to the same nic

ifconfig eth0:0 10.0.0.1
ifconfig eth0:1 192.168.1.99
ifconfig eth0:2 10.10.5.100

etc

These are good as long as the system is up. On RedHat you can create different files with the IP addresses down in
/etc/sysconfig/network-scripts
you will already have ifcfg-eth0 so you can just create an ifcfg-eth0:0 file as well.

Your otherchoice is creating name based virtual hosts.
It is an absolutely lousy tool in my opinion, but redhat's apacheconf tool may help you out. Better yet, download webmin from webmin.com and there is a nicer gui based tool for configuring apache.
 
Old 11-21-2004, 01:52 PM   #3
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by amfoster
You can do 1 of two things. You simply create virtual hosts in apache. They can be done on a name base or ip based.

ip based would simply require you to create virtual IP addresses.

if eth0 is 192.168.0.1
you can make etho:0 be a completely different ip and both will point to the same nic

ifconfig eth0:0 10.0.0.1
ifconfig eth0:1 192.168.1.99
ifconfig eth0:2 10.10.5.100

etc

These are good as long as the system is up. On RedHat you can create different files with the IP addresses down in
/etc/sysconfig/network-scripts
you will already have ifcfg-eth0 so you can just create an ifcfg-eth0:0 file as well.
Im going to try the ip based virtual host but i have a few questions.

1. how do i get etho to have those other ip addresses? I have a static ip address and im behind a firewall/router. so the ip address that my computer gets is 192.168.0.6, this is the ip that stands outside my dmz port. Also incase you need to know im running FC3.

2. When creating the virtual host with apache cant i do that by editing the .conf file for apache?

thanks help is really appreciated
 
Old 11-21-2004, 02:29 PM   #4
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 35
The "virtual IP addresses are made by issuing either
ifconfig eth0:0 192.168.1.99
or whatever IP address you want.

The hard coded way would be to create a file just like the
/etc/sysconfig/network-scripts file
but call it ifcfg-eth0:0

Instead of the word BOOTPROto=dhcp
it should read BOOTPROTO="static"
IPADDR=192.168.0.99
NETMASK=255.255.255.0

If you change your actual IP using setup or netconfig it will write the ifcfg-eth0 file the way you need it. just use that format then change your IP back to dhcp again
 
Old 11-21-2004, 02:55 PM   #5
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Original Poster
Rep: Reputation: 30
Ok i used the Network configuration tool in Gnome to do this.

i created
etho0: 192.168.0.6 (this was my defualt one, i didnt creat this one)
etho0:1 192.168.0.100 subnet 255.255.255.0 (this one is new, however it is used by static ip address)
etho0:2 192.168.0.101 subnet 255.255.255.0 (This one is new also)

Now is this what i should do (sorry if im far off but im pretty new to linux)
 
Old 11-21-2004, 03:04 PM   #6
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Set up the virtual hosts, i.e. in your httpd.conf:

Code:
<VirtualHost 192.168.0.100>
    // options
</VirtualHost>
<VirtualHost 192.168.0.101>
   // options
</VirtualHost>

etc...
If you're using private IPs and sitting behind a router doing port forwarding, I don't know how well this is going to work, because your router will have to forward HTTP requests for site1.com to 192.168.0.100 and for site2.com to 192.168.0.101. Enterprise class networking gear can do this easily, but the little $50 thing you buy down at Best Buy might not be able to. In that case, you might want to go with name based (rather than IP based) virtual hosting. In that case, all requests get sent by the same IP address and Apache decides based on the name of the site in the request which WWW page to show.
 
Old 11-21-2004, 06:40 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
i'd really advise against the ip based virtual host... it takes you down to a level of networking that you simply don't need to be concerned about. instead in apache, jsut enable name based virtualhosts in your httpd.conf (or apache.conf or whatever your distro uses):
Code:
NameVirtualHost *
then define your name based hosts just below.
Code:
<virtualhost *>
        ServerName two.com
        DocumentRoot /var/www/two
        ServerAlias www.two.com
        DirectoryIndex index.php
        LogLevel debug
        HostNameLookups off
</VirtualHost>

<virtualhost *>
        ServerName one.com
        ServerAlias www.one.com
        DocumentRoot /var/www/one
        DirectoryIndex index.php index.html index.htm index.shtml
        LogLevel debug
        HostNameLookups off
</VirtualHost>
no faffing about wtih IP's
 
Old 11-22-2004, 12:21 AM   #8
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Original Poster
Rep: Reputation: 30
to use the name based virtual host will i need to set up internal DNS?

thanks for all the help so far though
 
  


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
dns adding extra webserver bristi Linux - Networking 0 09-08-2005 06:23 AM
linux dns webserver for lan omgwtfbbqhax Linux - Networking 23 05-05-2005 04:43 PM
Webserver Redundency (DNS Gurus Pls) R4z0r Linux - Networking 1 09-20-2003 05:18 PM
Internal DNS server / Webserver MightyCranium Linux - Networking 6 04-02-2003 02:17 AM
Help with DNS and Webserver Evanrb04 Linux - General 3 06-28-2002 03:02 AM


All times are GMT -5. The time now is 06:52 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