|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
VeriSign Code Signing Digital Certificates provides assurance to end users. Read about this and more in the free white paper: “How to Digitally Sign Downloadable Code for Secure Content Transfer.” Learn More! |
|
#1
|
|||
|
|||
|
I am having problem with setting up a Virtual Host on a machine. I have read quite a few books and other articles and now I am completely confused. He is my story:
I setup a Linux machine, I will call it “my.domain.net”. I successfully: 1. Added to new Zone ( & reverse zone) statement in /etc/named.conf file 2. Added a new zone database file for “domain.net” Now I want to add a vhost www.abc.com. Do I need: a. Add an entry in zone file for www.abc.com b. Add a new database file for www.abc.com c. Update http.conf to add <VirtualHost> directive In one book, the above procedure is mentioned. In other articles, it says to add CNAME statement in the zone database file and update the http.conf file. What is the actual procedure? Other than updating http.conf what other files needs to be updated/added. Please help! I HAVE READ SO MUCH STUFF THAT I AM READY TO BLOW UP! Kirt |
|
#2
|
|||
|
|||
|
It is really quite simple. Make sure each domain has a DNS entry. Then add a Virtual host block to your httpd.conf file.
For example, <VirtualHost [ip]> ServerName [virtualhostname] DocumentRoot [directory] </VirtualHost> For example, one web site on my server is: # dnsconnection.net <VirtualHost 206.30.168.163> ServerName www.dnsconnection.net DocumentRoot /home/dnsconnect/public_html/ ErrorLog "/home/dnsconnect/logs/error_log" TransferLog "/home/dnsconnect/logs/transfer_log" </VirtualHost> Notes: You need to tell Apache that a certain IP may have different host names. If you do not tell it, it will find the first match and use it. If 206.30.168.163 was your virtual host IP, you would add the following to your httpd.conf file: NameVirtualHost 206.30.168.163 In order to make both www.domain.com and domain.com to work, you need to duplicate the Virtual Host block, but change the ServerName. |
|
#3
|
|||
|
|||
|
Frank:
Thanks for your answer. You left one items unexplained. What do yoy mean by "DNS entry"? Is it a "NS", CNAME, or what? I have no problem with updating the httpd.conf, my question is more towards what additional items are needed! Your answer is highly appreciated. Can you give an example of DNS entry? Kirt |
|
#4
|
|||
|
|||
|
Every domain needs a zone file and a zone statement in the named.conf file.
On my system, zone files are stored in /var/named. One example of a zone file on my system is /var/named/dnsconnection.net which contains: <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> @ IN SOA ns.dnsconnection.net. hostmaster.dnsconnection.net 20001018002 ; serial 300 ; refresh 250 ; retry 325 ; expire 325 ; default_ttl ) IN MX 5 dnsconnection.net. @ IN NS ns.dnsconnection.net. @ IN NS ns2.dnsconnection.net. @ IN A 206.30.168.163 www IN CNAME dnsconnection.net ftp IN CNAME 206.30.168.163 control IN CNAME 206.30.168.169 [/code] In my /etc/named.conf file, I put: <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> zone "dnsconnection.net"{ type master; file "/var/named/dnsconnection.net"; }; zone "www.dnsconnection.net"{ type master; file "/var/named/dnsconnection.net"; }; [/code] That points each domain (or sub domain) to its zone file. I can even point sub domains to different IP addresses by creating different zone files. O'Reilly has a good book called "DNS and Bind." http://www.amazon.com/exec/obidos/ASIN/1565925122/o/qid=973108167 /sr=8-1/ref=aps_sr_b_1_1/002-7672600-0937647 Best regards, Frank [This message has been edited by Frank (edited November 01, 2000).] |
|
#5
|
|||
|
|||
|
Frank:
My question still is not answered but I think we are close. If I take your last response and add another Virtual Host, are you saying that I should add another entry in zone file? If the answer is yes, then how that entry will look like. For Example, if I want to add a Virtual Site called www.abc.com, how I add an etry in the zone file? Is it a CNAME entry? Is the follwoing entry is correct: ode: -------------------------------------------------------------------------------- @ IN SOA ns.dnsconnection.net. hostmaster.dnsconnection.net 20001018002 ; serial 300 ; refresh 250 ; retry 325 ; expire 325 ; default_ttl ) IN MX 5 dnsconnection.net.@ IN NS ns.dnsconnection.net.@ IN NS ns2.dnsconnection.net.@ IN A 206.30.168.163www IN CNAME dnsconnection.netftp IN CNAME 206.30.168.163control IN CNAME 206.30.168.169 www.abc.com IN CNAME 206.30.168.169 -------------------------------------------------------------------------------- Then I update the /etc/named.conf by adding the www.abc.com as follows: code: -------------------------------------------------------------------------------- zone "dnsconnection.net"{ type master; file "/var/named/dnsconnection.net";};zone "www.dnsconnection.net"{ type master; file "/var/named/dnsconnection.net";}; zone "www.abc.com" { type master; file "/var/named/abc.com"; }; I think the confusion is about adding more than Virtual Site. REMEMBER I AM A NOVICE. Kirt -------------------------------------------------------------------------------- |
|
#6
|
|||
|
|||
|
Frank:
My last msg might be confusing, so I will try to clerify it. If I need to add a Virtual Web site, do I need to do the following: 1. Update httpd.conf - add <VirtualHost... 2. Update named.conf - add a zone statement 3. Create a new zone record Is it correct? Kirti |
|
#7
|
|||
|
|||
|
You are correct. And once you have edited all those files, restart BIND and Apache.
On my system, BIND is restarted with: ndc restart And Apache with: apachectl restart However, in the default Red Hat installation, it was restarted with: /etc/rc.d/init.d/httpd restart I hope this helps. Frank |
|
#8
|
|||
|
|||
|
Frank:
I am finally getting to testing this. I installed Apache_1.3.12 and noticed that the default httpd.conf is now in /usr/local/apache/???. Does it cause to problem?? Kirt |
|
#9
|
|||
|
|||
|
There are 2 different issues going on here... DNS/Bind and Apache. Deal with the DNS issue first. Get the name to resolve to the ip address. Apache has nothing to do with this part. But typing http://www.abc.net/ into a browser won't work if the ip doesn't resolve properly. The zone file doesn't look right. You wouldn't have a CNAME record for www.abc.net under a SOA for dnswhatever.com. It would be in a abc.net zone file. That's the first issue I see. Get the 'nslookup www.abc.net' returning the right IP address then setup the virtualhost entry in httpd.conf, it appears you have the docs explaining how to do this.
------------------ Robert Porter MCSE, MCP+I, CCNA |
|
#10
|
|||
|
|||
|
Robert:
I agree with you. I should first handle DNS. I have read so many articles and books with conflicting information. I want to stick to CNAME entry in DNS. So help me out. If my nameserver (NS) is ns1.mydomain.net and the Virtual Domain is www.abc.com, then the correct format for the CNAME entry is: www.abc.com IN CNAME ns1.mydomain.net Is it correct??? Kirt |
|
#11
|
|||
|
|||
|
PTR......
don't forget about that man i always forget to do that... i use ndc reload.... to restart BIND... never seen restart. ccbcreg <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by webpro: There are 2 different issues going on here... DNS/Bind and Apache. Deal with the DNS issue first. Get the name to resolve to the ip address. Apache has nothing to do with this part. But typing http://www.abc.net/ into a browser won't work if the ip doesn't resolve properly. The zone file doesn't look right. You wouldn't have a CNAME record for www.abc.net under a SOA for dnswhatever.com. It would be in a abc.net zone file. That's the first issue I see. Get the 'nslookup www.abc.net' returning the right IP address then setup the virtualhost entry in httpd.conf, it appears you have the docs explaining how to do this. [/quote] [This message has been edited by ccbcreg (edited November 28, 2000).] |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Virtual Hosts.. Everybody says it's EASY.. ?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|