Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want people to be able to use a custom domain name to access an application I have hosted on my server. From what I have read, people can do this by changing the A Record of their accounts to my IP address. On this IP they are supposed to point to, I have other applications hosted there. How do I configure it on my own end such that when they set their A Name record and point it to my IP, I direct them to the folder where the application is.

I have a dedicated server running on Ubuntu Linux 9.10

share|improve this question
little bit more detail please as what webserver if any. Like in apache you can setup virtual host to achieve what you described above. – Raj J Jul 29 '11 at 15:32
Your application - is it a web app, meaning hosted by a web server? What type of application is it? – dwmcc Jul 29 '11 at 15:39
The answer for this depends on your webserver. In Apache, it's as simple as changing the virtualhost a bit. – NickAldwin Jul 29 '11 at 15:45
up vote 1 down vote accepted

Name resolving is not related to this and like you said, if customer has the name set to point to your webserver things are fine on that side. But in order to have things really work, you need to instruct your httpd to serve the right content for the 3rd party domain.

With apache you can add ServerAlias to the virtualhost block or you could utilize mod_alias and make one main site and symlink the rest


Since the hosting of dns entries of a 2rd party domains happens on their own / or hosted on even on 3th party dns servers, the only way easy method to archive this is that the person needs to notify your application that now there's a new domain added to your application. This could be a configurable option in your app settings.

When you have the information what domain your client wants to add, you can automate the generation of a new mod_alias site OR adding of a new ServerAlias directive into existing virtual host, or even, creating a new virtual host completely from the default template - and when these are done, restart the apache.

Another option could be you make your application a default virtual host that doesnt care about domain names at all and serve all content from that so that when webserver receives request from client with unknown domain, it would still serve your application to the user ..

share|improve this answer
Is it possible for me to do this automatically from a script (php) that connects to a db to check if there aer serveraliases to add – yankitwizzy Aug 2 '11 at 14:54
^ check addition, ask more if needed – rasjani Aug 4 '11 at 9:31

It sounds like you need to set up named virtual hosts in your HTTP server configuration.

share|improve this answer
Using name based virtual hosts he would have to list every name possible as ServerAliases in his Apache config. He wants exactly not named virtual hosts. – bahamat Jul 29 '11 at 15:57
@bahamat serveralias * ? – Iain Jul 29 '11 at 16:06
"How do I configure it on my own end such that when they set their A Name record and point it to my IP, I direct them to the folder where the application is." I took this to mean a 1:1 mapping... I guess he wants many:1. Sorry. – Chris Nava Jul 29 '11 at 16:52

Actually what you don't want is a name based virtual host. Create a single default website with no alternatives. No matter what name is used, it will always select the same web content.

If Ubuntu uses Debian's Apache config structure then it all but forces you to use virtual hosts. In this case use only one on that IP. No other virtual hosts can share that IP.

share|improve this answer
Given the information provided I would have gone for NBVH but there really isn't sufficient information to judge correctly. – Iain Jul 29 '11 at 16:08
@lain Please what is the meaning of NBVH? – yankitwizzy Aug 2 '11 at 14:55

Your Answer


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.