[bug?] Custom templates and DOCROOT

v3loxy

New member
Joined
May 25, 2012
Messages
5
Hello,

My IP got changes recently and my host updated DirectAdmin on my VPS resulting in the loss of my custom templates.

While I was redoing my templates i noticed something strange.

In my httpd.conf customization page i have the following line:
Code:
|*if SUB="movies"|
|?DOCROOT=/home/admin/domains/movies.yogglr.me/html|
|*endif|

The following is my virtual_host2_sub.conf:
Code:
|?DOCROOT=`HOME`/domains/`SUB`.`DOMAIN`|
|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/var/tmp:/usr/local/lib/php/|
<VirtualHost |IP|:80 |MULTI_IP|>
[COLOR="Red"]# |DOCROOT|[/COLOR]
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/`SUB`/cgi-bin/|
        ServerName |SUB|.|DOMAIN|
        ServerAlias www.|SUB|.|DOMAIN| |SUB|.|DOMAIN| |SERVER_ALIASES|
        ServerAdmin |ADMIN|
        DocumentRoot |DOCROOT|
        |CGI|

        |USECANONICALNAME|

        #SuexecUserGroup |USER| |GROUP|
        RMode config
        #RDocumentChRoot /home/|USER| |DOCROOT|
        RUidGid |USER| |GROUP|
        RGroups apache
        |CUSTOM|
        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.bytes bytes
        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.log combined
        ErrorLog /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log

        <Directory |DOCROOT|>
[COLOR="Red"]# |DOCROOT|[/COLOR]
                Options +Includes -Indexes

|*if CLI="1"|
                php_admin_flag engine |PHP|
                <IfModule !mod_php6.c>
                        php_admin_flag safe_mode |SAFE_MODE|
                </IfModule>
                php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f |USER|@|DOMAIN|'
|*endif|
|*if OPEN_BASEDIR="ON"|
                php_admin_value open_basedir |OPEN_BASEDIR_PATH|
|*endif|
|*if SUPHP="1"|
                suPHP_Engine |PHP|
                suPHP_UserGroup |USER| |GROUP|
|*endif|
        </Directory>
        <Location /phpMyAdmin>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /phpmyadmin>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /squirrelmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /roundcube>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /uebimiau>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /webmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /atmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
|HANDLERS|
|MIMETYPES|

</VirtualHost>


Code:
<VirtualHost 83.172.180.157:80 >
[COLOR="Red"]# /home/admin/domains/cms.yogglr.me[/COLOR]

	ServerName cms.yogglr.me
	ServerAlias www.cms.yogglr.me cms.yogglr.me 
	ServerAdmin [email protected]
	DocumentRoot /home/admin/domains/cms.yogglr.me
	
	UseCanonicalName OFF

	#SuexecUserGroup admin admin
	RMode config
	#RDocumentChRoot /home/admin /home/admin/domains/cms.yogglr.me
	RUidGid admin admin
	RGroups apache
	
	CustomLog /var/log/httpd/domains/yogglr.me.cms.bytes bytes
	CustomLog /var/log/httpd/domains/yogglr.me.cms.log combined
	ErrorLog /var/log/httpd/domains/yogglr.me.cms.error.log

	<Directory /home/admin/domains/cms.yogglr.me/webroot>
[COLOR="Red"]# /home/admin/domains/cms.yogglr.me/webroot[/COLOR]
		Options +Includes -Indexes
        

		php_admin_flag engine ON
		<IfModule !mod_php6.c>
			php_admin_flag safe_mode OFF
		</IfModule>
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'



	</Directory>
	<Location /phpMyAdmin>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /phpmyadmin>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /squirrelmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /roundcube>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /uebimiau>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /webmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
        <Location /atmail>
                RMode config
                RUidGid webapps webapps
                RGroups apache
        </Location>
	
</VirtualHost>

Notice the red text, why does |DOCROOT| have 2 different values in the same file? Custom sub domains aren't working because of this issue.
 
Code:
|*if SUB="movies"|
|?DOCROOT=/home/admin/domains/movies.yogglr.me/html|
|*endif|

should be

Code:
|*if SUB="cms"|
|?DOCROOT=/home/admin/domains/cms.yogglr.me/html|
|*endif|

I have several subdomains set up like this, wanted to use one as example but copied the wrong one. The issue is the same for all sub domains.
 
No one knows why |DOCROOT| is wrong under <VirtualHost> and not under <Directory>?
 
Your data and its peaces do not match each other. You write this code

Code:
|*if SUB="cms"|
|?DOCROOT=/home/admin/domains/cms.yogglr.me/html|
|*endif|

so the document root path ends on html

but at the same time you post your httpd.conf with:

Code:
# /home/admin/domains/cms.yogglr.me/webroot

So what is it all about?
 
Your data and its peaces do not match each other. You write this code

Code:
|*if SUB="cms"|
|?DOCROOT=/home/admin/domains/cms.yogglr.me/html|
|*endif|

so the document root path ends on html

but at the same time you post your httpd.conf with:

Code:
# /home/admin/domains/cms.yogglr.me/webroot

So what is it all about?

I'm mixing it up, it should be both ending with webroot.
 
HTML:
|?DOCROOT=`HOME`/domains/`SUB`.`DOMAIN`|
|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/var/tmp:/usr/local/lib/php/|
<VirtualHost |IP|:80 |MULTI_IP|>
# |DOCROOT|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/`SUB`/cgi-bin/|
        ServerName |SUB|.|DOMAIN|
        ServerAlias www.|SUB|.|DOMAIN| |SUB|.|DOMAIN| |SERVER_ALIASES|
        ServerAdmin |ADMIN|
        DocumentRoot |DOCROOT|
        |CGI|

        |USECANONICALNAME|

        #SuexecUserGroup |USER| |GROUP|
        RMode config
        #RDocumentChRoot /home/|USER| |DOCROOT|
        RUidGid |USER| |GROUP|
        RGroups apache
        |CUSTOM|
        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.bytes bytes
        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.log combined
        ErrorLog /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log

        <Directory |DOCROOT|>
# |DOCROOT|

OK, I guess I know, why it happens

You redefine |DOCROOT| in custom part of the template, which comes much lower

Code:
DocumentRoot |DOCROOT|

try to move |CUSTOM| upper, something like this

HTML:
        |CUSTOM|
        DocumentRoot |DOCROOT|
        |CGI|

        |USECANONICALNAME|

        #SuexecUserGroup |USER| |GROUP|
        RMode config
        #RDocumentChRoot /home/|USER| |DOCROOT|
        RUidGid |USER| |GROUP|
        RGroups apache

        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.bytes bytes
        CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.log combined
        ErrorLog /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log


Though this solution should do a trick, this behavior of Directadmin is a bug probably.
 
Back
Top