LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   DNS and Webserver help (https://www.linuxquestions.org/questions/linux-newbie-8/dns-and-webserver-help-257191/)

Fredstar 11-20-2004 08:05 AM

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

amfoster 11-20-2004 09:38 AM

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.

Fredstar 11-21-2004 12:52 PM

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

amfoster 11-21-2004 01:29 PM

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

Fredstar 11-21-2004 01:55 PM

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) :newbie:

btmiller 11-21-2004 02:04 PM

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.

acid_kewpie 11-21-2004 05:40 PM

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

Fredstar 11-21-2004 11:21 PM

to use the name based virtual host will i need to set up internal DNS?

thanks for all the help so far though


All times are GMT -5. The time now is 08:47 PM.