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 want to add a web site to a Centos VPS programmatically, I found many references to IIS, but nothing for Linux.

I have a site that lets the users create a customized web site. What I want is give the users the option to use their own domain.

So, when the user add his/her own domain (and point his/her domain to my DNS server) add this domain as an add-on domain to my server and also add a virtual host to apache....

any help will be appreciated...

Regards Alex

share|improve this question

3 Answers 3

Something like cPanel or ISPconfig ?

share|improve this answer
    
I need this to be programmatically, is there a CPanel API? –  Alejandro Angelico Jul 25 '12 at 17:05

You can install virtualmin and use their API via REST URL or run script remotely. It does mailboxes too.

share|improve this answer

Yes, this is simple. I've previously run a webfarm (using 1.3.27) with around 1000 vhosts configured on each server exactly like this - startup took a couple of seconds longer but otherwise there was little difference from a single vhost. Just specify a directory to contain the definitions for the vhosts (one per file) and set up a directory tree for each website. The machine I'm typing this at came with Apache 2.2 pre-configured to handle just such a case; in the httpd.conf there's a line:

Include conf/vhosts.d/*.conf

And the create a file, say example.com.conf containing:

 <VirtualHost example.com>
 ServerName example.com
 ServerAlias www.example.com
 DocumentRoot /var/vhosts/example.com/www
 CustomLog /var/vhosts/example.com/logs common
 ErrorLog /var/vhosts/example.com/logs
 </VirtualHost>

You might want to create a user at the same time and point their home directory to the base locattion (/var/vhosts/example.com). I'd recommend disabling all cgi / shtml / php /symlinks etc unless you know how to configure these securely. Preferably allow override none too.

An alternative approach is to use a wildcard vhost with all requests routed to your front controller which would then invoke specific bits of functionality - but this requires rather a lot of development effort.

share|improve this answer
    
Thanks @symcbean, this is what I want. but is it possible to add the domain to my dns? –  Alejandro Angelico Jul 25 '12 at 17:06
    
Yes - but you don't say what DNS server it is (I used bid and it was much the same process with an SOA record. –  symcbean Jul 25 '12 at 21:45
    
Sorry, I'm using Bind This is returned by # named -v BIND 9.3.6-P1-RedHat-9.3.6-16.P1.el5_7.1 –  Alejandro Angelico Jul 26 '12 at 17:04

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.