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.

We just went from shared hosting to a VPS server. We have several domain names that we have pointing to our dns, but they all point to the root of the server. What I would like now is a setup where every domain name gets its own map so we can run different sites on the VPS server.

Like:

www.example.com points to: /var/www/example.com www.imapwnu.com points to: /var/www/imapwnu.com

First of all, is this possible? Second, I have root SSH access and Webmin, on a LAMP server running on Ubuntu. Webmin doesnt have Bind9 (I dont know if I need that, some forums pointed me towards something called bind).

Thanks in advance

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The technology that you need to get familiar with is Name Based Virtual Hosting. It's relatively easy to set up and a basic example would be something like this

Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/example.com
</VirtualHost>

<VirtualHost *:80>
    ServerName www.imapwnu.com
    ServerAlias imapwnu.com
    DocumentRoot /var/www/imapwnu.com
</VirtualHost>

This accepts requests for www.example.com,example.com then serves the content from /var/www/exampl.com and requests for www.imapwnu.com,imapwnu.com then serves the content from /var/www/imapwnu.com.

Regarding bind9, if you already have all of your domain's DNS working with various registrars then right now that's the safest place for you to leave them.

share|improve this answer
    
Thanks man! I have it running! :) –  Hans Wassink Sep 25 '12 at 11:10

As you mentioned you want to point www.example.com to /var/www/example.com and same for every domain you have.

The answer is Yes you can do so. But you have to do configure your webserver (Apache) and add Virtual Hosts.

Read more on Virtual Hosts. You do not require Bind to run on your VPS unless you want to setup a full fledged DNS Server farm. Which i think you can avoid right now because you can use your Domain Registrar's DNS Servers to manage your domain.

All you have to do is to logon to your domain registrar account (e.g godaddy) then goto DNS Manager and Add an A record.

The A record tells us where a particular domain name is pointed at. It's value is IP Address.

So in your case if you have example.com and you want to run this on your VPS then you have to modify A record for example.com and enter the IP address of your VPS. Then goto your server and configure webserver to listen for example.com.

You can point all of your domain names in this way. But not to forget to read on virtual hosts.

share|improve this answer
    
Thanks for your answer man! I read up on Virtual hosts and I have everything running now! –  Hans Wassink Sep 25 '12 at 11:10

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.