|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Two domain names...
Hi,
I currently own 2 domain names. One, in which I have pointed to my server so I can host it. The other is just lying around doing nothing. I wanted to get the domain name back up and running. How do I add a second domain name to apache ? Thanks, Skeasor
__________________
____________ Thanks, Skeasor Got Debian Linux? www.debian.org |
|
#2
|
|||
|
|||
|
You need to disable the general server name set in the apache config file, and need to add a virtual host for EVERY domain you are hosting, so also for your servername for example.
<VirtualHost *> ServerAdmin you@yourdomain.com DocumentRoot /web/yourdomain.com/html ServerName www.yourdomain.com ErrorLog /web/yourdomain.com/logs/yourdomain.com-error_log CustomLog /web/yourdomain.com/logs/yourdomain.com-access_log common </VirtualHost> Hope this helps! Iwan van der Schoor |
|
#3
|
|||
|
|||
|
DocumentRoot
If I setup a virtual host for all of my domains and use the DocumentRoot inside of the virtual host command, what should I do with the DocumentRoot thats not in the virtual host tag.
Thanks, Skeasor |
|
#4
|
|||
|
|||
|
Skeasor,
You can just leave that I think. As far as I am aware, as soon as you start hosting more than 1 domain, it will always use one of the virtualhosts, so if you have your documentroots defined in there correctly you are ready to run. Thanks, Iwan |
|
#5
|
||||
|
||||
|
Will this same setup work for local machines? If I have a machine named "server", but I want to host two internal sites named "site1" and "site2", can I set up Apache to handle requests for "http://site1" and "http://site2"? Would I have to add DNS entries for "site1" and "site2"?
__________________
Jon Sagara "Me fail English? That's unpossible!" |
|
#6
|
|||
|
|||
|
>> Would I have to add DNS entries for "site1" and "site2"?
Just setup a Hosts file. For example, /etc/hosts or C:\Windows\Hosts: 127.0.0.1 localhost site1.localdomain.com site2.localdomain.com |
|
#7
|
||||
|
||||
|
And then Apache's virtual hosting capabilities will point the request to the correct document root, right?
|
|
#8
|
|||
|
|||
|
Apache reads /etc/resolv.conf and /etc/hosts. If you setup /etc/hosts correctly, Apache will recognize site1 and site2 and resolve to 127.0.0.1. This is the minimum DNS requirement in order for you to create <VirtualHost> and assign different ServerName and DocumentRoot based on the servername.
|
|
#9
|
||||
|
||||
|
Cool, thanks for the info.
|
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Two domain names... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|