DNS and virtual web servers

hello,
       This is what i want to do in a Linux RedHat 6.0 shell box:
  The shell contains two DNS entries already ( two domains with their sub-domains and the ips to which they point ). I want to add another dns entry which will point to the same ip as the other two BUT when called for web pages it will not use the default document root of apache as the other two but will point to another document root. That is to say, if the domain i want to add is new.com and one of the existing ones os old.com : when old.com is called by a web browser it will point to /home/httpd/html/ but when new.com is called by a web browser it will point to /home/httpd/html/new/ Someone told me that i need to create a virtual web server, so the question is how to do all this. I appreciate your help.
   Solutions via Linuxconf prefered because this is the only utility which i am sure is stable and safe 100%

 Thanks,
            Mixelogj
LVL 1
mixelogjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jlevieCommented:
The person that told you that you need to create a virtual web server is correct. There are two ways to do so, via IP aliasing (aka multihoming) where you assign additional IP address to an interface, and via apache's VirtualHost directive where the requested URL determines which virtual server to use.

In my opinion, VirtualHosts are cleaner, needing only a CNAME record in the DNS to define the server name. The Apache docs have a complete description of how to set one of these up. If you don't have the docs on-line, go to www.apache.org/docs.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mixelogjAuthor Commented:
hhm.. kinda complicated there in the docs. i didn't know what should i read because it had many possibilities. anyway, good try but i still need help on that. plz gmme the steps they are a few anyway as i've been told
0
jlevieCommented:
Basically all that's needed, per the docs, is to tell Apache it's using named virtual hosts and to define the virtual host. An example from one of my Apache installations looks like:

NameVirtualHost 192.168.0.3
:
## Plaintext Virtual Host
<VirtualHost 192.168.0.3:8080>
ServerName docs.dynetics.com
ServerAdmin Jim.Levie@dynetics.com
DocumentRoot "/opt/Apache/htdocs/docs"
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

Apache does need to be listening at the global level on the port (even if there are no "servers" defined at the global level). This one is configured to listen on 80, 8080, & 443 and all of its server instances are virtual.
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

mixelogjAuthor Commented:
so in my case, if new.com should be the virtual host the form should be:

NameVirtualHost new.com
                      :
                      ## Plaintext Virtual Host
                      <VirtualHost new.com>
                      ServerName newest(any name)
                      ServerAdmin me@new.com
                      DocumentRoot "/home/httpd/html/new/"
                      <Directory />
                          Options Indexes FollowSymLinks
                          AllowOverride None
                          Order allow,deny
                          Allow from all
                      </Directory>
                      </VirtualHost>

right?
0
jlevieCommented:
Not quite... In my example the system Apache is running has the DNS A records  in the dynetics.com domain of:

mystic  IN A     192.168.0.3
docs    IN CNAME mystic.dynetics.com.

I tell Apache that I'll be using named virtual hosts whose connections to the server will be coming in on IP 192.168.0.3 via:

NameVirtualHost 192.168.0.3

"<VirtualHost 192.168.0.3:8080>" declares a new virtual host listening on 8080 in this case, and "ServerName docs.dynetics.com" says that this virtual server will respond only to URL's that look like "http://docs.dynetics.com".
0
jlevieCommented:
Followup to the last comment (I accidentally hit Submit).

In your case you should have a DNS definition that points "new.com" at the base IP of your server and you'd put that into ServerName, i.e., "ServerName new.com"

The relevant DNS records from the two zone files would look something like:

base (or real zone):

$ORIGIN  base-domain.com
server  IN A  192.168.0.1

virtual domain zone:

$ORIGIN new.com
www     IN A  192.168.0.1

Note that you don't need or want a reverse addr definition for the virtual hosts, but that you do need one for the base server
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.