Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a dedicated server with a domain hosted on it and running.

I have bought another IP for the same server so I can link it to another domain.

I have updated the A DNS record for the new domain by adding the newly purchased IP.

Now what should I do ? This server is unmanaged host, and doesn't run any web panel. I have root access via SSH.

Do i need to configure my apache ?

Thanks.

share|improve this question

2 Answers 2

You host your own DNS, great. So when you add a new domain to the DNS server. restart you DNS server. Once you have the DNS pointing to your virtual domain server, you need to tell your Web server where to find the Web files for the domain.

Apache configuration:
The way Apache works, if you have set up virtual domains, the first domain entered is the default. This is the directory that will be displayed when a virtual domain is not listed in the configuration.(In other words, if the DNS entry made above sends the URL to your IP, but you don't have the virtual host in your httpd.conf file). Let's see an example:

You have bought the domain www.adogslife.com and you want to host it at the hosting service with the IP 10.1.1.1 (which you also own).
DNS is set up to point to that IP. Now you must edit your Apache httpd.conf file:

1. Go to the section of the httpd.conf file on Virtual hosting (sometimes it's in srm.conf)
2. Make sure that the NameVirtualHost points to your IP:NameVirtualHost 10.1.1.1
3. The first virtual host entry should be your default domain:


<VirtualHost 10.1.1.1>
ServerName www.defaultdomain.com
DocumentRoot /var/www/domain
</VirtualHost>


4. Then list the new domain, with any options you'd like to add:


<VirtualHost 10.1.1.1>
ServerName www.adogslife.com
DocumentRoot /var/www/dogslife
ErrorLog /var/log/apache2/adogslife.com-error_log
TransferLog /var/log/apache2/adogslife.com-access_log
</VirtualHost>
Note, I added two lines to the second virtual host. These allow you to separate out the Error and Transfer logs for the new domain from your default domain. If you are going to host virtual domains for other people, they will almost certainly want their server logs, and this makes it easy to provide that to them as well.

share|improve this answer

By default, Apache will listen on all interfaces defined on the server. To get around this, the easiest way is to configure Apache to use virtual hosts. This link points to the Apache documentation on virtual hosts.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.