I'm sorry to ask this again, but I have a different variant of this question.
/var/www/vhosts/domain.com/conf/vhost.conf I want to automatically route subdomains to their own DocumentRoot and was wondering if I could use this type of set up
I used the keyword
DYNAMIC_SUB to represent a domain that will be made automatically.
I have no idea how to make a vhost.conf entry to do what i want so I took this template from an already existing entry that points
domain.com to my server and related directories, I modified it to show an idea of what I was looking for. I know some people might chuckle while looking at it ;-) but its a learning experience and we were all here at some point or another.
I'm trying to let users create accounts and to give them their own sub domain instead of the usual url segment.
test.domain.com instead of
I use Plesk 10 for Linux, and the Plesk API is crap with making sub domains, so I figured making my own would be better, I just need it as a point of reference so a user can store small files while still being served the index.php files from the main directory using some PHP tricks.
Right, well to make long story short I'm trying to make
http://www.test.domain.com AND http://test.domain.com all point to their own sub domain folder while still going to either
http://www.domain.com OR http://domain.com will point to the web root.
I have a DNS record in my Zone File
domain.com with an A record pointing to my HOST_IP *.domain.com with an A record pointing to my HOST_IP www.domain.com with an A record pointing to my HOST_IP <VirtualHost HOST_IP:80> ServerName "DYNAMIC_SUB.domain.com:80" ServerAlias "DYNAMIC_SUB.domian.com" UseCanonicalName Off <IfModule mod_suexec.c> SuexecUserGroup "USER_GROUP" "psacln" </IfModule> ServerAdmin "email@example.com" DocumentRoot "/var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB" CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog ErrorLog "/var/www/vhosts/domain.com/statistics/logs/error_log" <IfModule mod_userdir.c> UserDir "/var/www/vhosts/domain.com/web_users" </IfModule> ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.com/users/DYNAMIC_SUB/cgi-bin/" Redirect permanent /plesk-stat https://domain.com/plesk-stat Redirect permanent /webstat https://domain.com/webstat Redirect permanent /webstat-ssl https://domain.com/webstat-ssl Redirect permanent /ftpstat https://domain.com/ftpstat Redirect permanent /anon_ftpstat https://domain.com/anon_ftpstat Redirect permanent /awstats-icon https://domain.com/awstats-icon <IfModule mod_ssl.c> SSLEngine off </IfModule> <Directory /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/> <IfModule mod_perl.c> <Files ~ (\.pl$)> SetHandler perl-script PerlHandler ModPerl::Registry Options ExecCGI allow from all PerlSendHeader On </Files> </IfModule> <IfModule sapi_apache2.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/ </IfModule> <IfModule mod_php5.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/ </IfModule> <IfModule mod_python.c> <Files ~ (\.py$)> SetHandler python-program PythonHandler mod_python.cgihandler </Files> </IfModule> <IfModule mod_fcgid.c> <Files ~ (\.fcgi)> SetHandler fcgid-script Options +FollowSymLinks +ExecCGI </Files> </IfModule> Options -Includes +ExecCGI </Directory> Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs" Include "/var/www/vhosts/domain.com/conf/vhost.conf" </VirtualHost>