Solved

Subdomain / DNS / Apache

Posted on 2000-03-22
13
831 Views
Last Modified: 2008-02-26
Hi,

I have a Redhat 6.0 installation in a local network.

I'd like to have a virtual web server - a subdomain - like

http://test.my_linux_box

I think I know how to do this in apache, but where should I define the DNS name? I thought adding this to local /etc/hosts would be enough.

Please advise
Uli
0
Comment
Question by:hitzeu
  • 6
  • 3
  • 3
  • +1
13 Comments
 

Expert Comment

by:salikova
ID: 2643991
I believe that you would find the full information
in .../redhat-x.x/i386/doc/HOWTO/DNS-HOWTO
at www.redhat.com  or www.linux.org site

I use private subnet 192.168.3.xxx
arp -a
Net to Media Table
Device   IP Address               Mask      Flags   Phys Addr
------ -------------------- --------------- ----- ---------------
le0    FEL-Linux.private.net 255.255.255.255       00:60:97:2f:ec:2f
le0    ultrasparc-fel.private.net 255.255.255.255 SP    08:00:20:88:e2:99
0
 

Author Comment

by:hitzeu
ID: 2644049
Hi,

I know this document but I don't look through it.
I've seen the named.conf file before, but there is something about a zone file whatever.

Please explain steps to create subdomain (alias to linux box).

Thanks
0
 
LVL 2

Expert Comment

by:mapc
ID: 2644344
Quite simple:
you need either A or CNAME record for this site, if using "byname" virtual host, or it should have another ip and corresponding A record if using "byip" virtual host.
Thus you have two options:
1) using HTTP procotol, you just need to add a CNAME to this host; example:
the hostname is www.mapc.org
you want test.mapc.org.
in the dns you shall add:
test IN CNAME www
and in httpd.conf
NameVirtualHost ip-of-www
<VirtualHost ip-of-www>
ServerName www
DocumentRoot /original/doc/root
</V..>
<Vir.. ip-of-www>
ServerName test
DocumentRoot /test/doc/root
</v..>
etc.
however, if you don't want people to know that it's the same computer, you could assign another ip to the www computer.
say, 10.0.0.1 IN PTR www
10.0.0.2 IN PTR test
in the reverse map.
Then, in the machine do ifconfig le0:1 10.0.0.2 (replace le0 to your interface name)
and add it to hosts,
then in apache, <Virt.. 10.0.0.1>
Doc.. /orig/docs
</V..>
<Virt.. 10.0.0.2>
Doc.. /tets/docs
</V..>
That's it.
0
 

Author Comment

by:hitzeu
ID: 2644437
Thanks for your update.
It looks good.

I succesfully applied virtual server to apache.

BUT:
"
in the dns you shall add:
test IN CNAME www
"

1- do you mean named.conf ?
2- named is not running on system startup, where do I specify this and that the DNS server is used by system ? resolv.conf ?

Hope you can help again.
Thanks a lot.

Uli
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2644509
If you don't have a named running, that means your system isn't the one that supplies the DNS information for the domain. You have to contact the folks who are responsible for the DNS server and get them to add the CNAME record.
0
 

Author Comment

by:hitzeu
ID: 2644518
I'm in a local network.
I know my linuxbox has it's hostname in a global DNS server elsewhere.
I thought subdomains are specified in a local DNS server??
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Accepted Solution

by:
mapc earned 50 total points
ID: 2644823
Ok,
I thought that you're the network admin.
Since if you're not, it'll be hard to persuade her to add this :)
Or maybe not.
Anyhow, if you just want to play with local netscape on that machine, then, adding this to /etc/hosts:
10.0.0.1 www test www.mapc.org test.mapc.org
will be sufficient- e.g. apache will bring different pages whenever it sees test of www in the url.
NOTE: add ServerAlias www in the definition of VirtualHost, e.g.
<V..>
ServerName www.mapc.org
ServerAlias www
....
</V..>
so in netscape you'll be able to go to:
http://test/
and
http://test.mapc.org/

P.S. if the answer is good but incomplete, just comment on it, and then people will respond.

P.P.S. there may be situation when you'd like to play with named, then, you create all the maps, and you shall setup your machine (/etc/resolv.conf) to use itself for resolving, and to do so on other clients, but that's out of scope of the question.
0
 

Author Comment

by:hitzeu
ID: 2644882
Thanks for the update.
I knew how to add s.th. to /etc/host
You'll receive the points anyway.

1- So subdomains are NOT specified on a local machine????
I can't believe this. E.g. when you register a web domain at NIC...you can have as many subdomains as you like, right? Bot you don't trouble NIC with this, you configure your system. Did I misunderstand something?

2- how do I enable automatic startup of named ?

Thanks a lot
Uli
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2645032
Yes, when you register a domain you have the rights to create as many subdomains below it as you wish. However, they must be created on the primary dns server, or it must be configured to delegate the responsibility for the subdomains to a nameserver in the subdomain.

You'll note that in each case the primary dns server requires a change. Yeah you could set up a "named" locally, but nothing other than your local machine will use that data. Other systems will consult only the "official nameservers" for the domain and they won't know about yours.

Do what I said earlier and contact those who are responsible for your domain and get them to add the records. If you have the connection speed and resources to do so, you can set up a nameserver and have the primary nameserver transfered to your system.
0
 

Author Comment

by:hitzeu
ID: 2645038
Did this. Worked :-)

I just want to know how to start named (or any other service) automatically.

Thanks
Uli
0
 
LVL 2

Expert Comment

by:mapc
ID: 2645147
If this is linux and there's /etc/rc.d/init.d/named, then:
ln -s /etc/rc.d/init.d/named /etc/rc.d/rc3.d/S10named
or replace rc3 with rc5 if your init level is 5 and not 3 (see /etc/inittab)
If not, you can create such file, it should be something like /etc/rc.d/init.d/lpd does, e.g. if you replace lpd with named it may work, or, then again it may not, but you can check how this is done.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2645164
Okay, services like named are started at boot time from an init script in the /etc/rc.d hierarchy. You can manually fiddle with the files and links, or more easily with less chance for errors you can enable/disable services via linuxconf (Control>Control Panel>Control service activity). Note that if a package that provides some service hasn't yet been installed it won't appear in the list.
0
 

Author Comment

by:hitzeu
ID: 2645169
Thx all.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now