I would like to create a web platform where each customer get its own site like uservoice.com
Example:
The objective is that the customer can enter its site via its own url & login page.
Does anyone know how to do that? How to avoid a sub-directory by subdomain and copy all the files? I am looking for a clean and scalable solution.
I think the solution is a name-based virtual host.
For example the domain cust2-subdomain.uservoice.com will display the content located in a different folder than your DocumentRoot but the address will be unchanged. The server will recognize the domain and send the appropriate content.
Include conf/extra/httpd-vhosts.conf
Then you should edit /usr/local/apache2/conf/extra/httpd-vhosts.conf.
<VirtualHost *:80>
ServerAdmin you@uservoice.com
DocumentRoot "/usr/local/apache2/docs/uservoice.com"
ServerName uservoice.com
ServerAlias www.uservoice.com
ErrorLog "logs/uservoice.com/error_log"
CustomLog "logs/uservoice.com/access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin cust2@uservoice.com
DocumentRoot "/users/customers/cust2/WWW"
ServerName cust2-subdomain.uservoice.com
ServerAlias www.cust2-subdomain.uservoice.com
ErrorLog "logs/cust2/error_log"
CustomLog "logs/cust2/access_log" common
</VirtualHost>
The first section is for your site and the second one for cust2's site. So cust2 will put his site into the WWW folder located in his home directory. You will put your content in your old DocumentRoot. (You will need to customize /usr/local/apache2/conf/extra/httpd-vhosts.conf).