AH00112: Warning: DocumentRoot [/etc/httpd/`REALDOCROOT` ] does not exist

ShinJii

Verified User
Joined
Mar 20, 2014
Messages
219
Hi,
I had since 3-4 years settings in CUSTOM HTTPD of my domain

Apache config:
|*if SUB|
|?DOCROOT=`REALDOCROOT`/subdomains|
|*endif|
And suddenly 1hour ago I had ERROR 404 in every of my subdomain.... and I found out in APACHE ERROR logs something like:
AH00112: Warning: DocumentRoot [/etc/httpd/`REALDOCROOT`/subdomains/nameofsubdomain] does not exist

Why? When I changed `REALDOCROOT` to real path it's working again.... why it was broken? I didn't update apache/php etc... nothing... suddenly it stopped working just like that.... after 3-4 years O_O

I try rebuild apache/php but it didn't work.... only add real path worked.
 
Hello,

If you recently updated DirectAdmin it could point to a possible bug. So if anybody can confirm it? Or you might report it to DirectAdmin developers via tickets?
 
Hello,

If you recently updated DirectAdmin it could point to a possible bug. So if anybody can confirm it? Or you might report it to DirectAdmin developers via tickets?

I updated DA to 1.60.4 few days ago... more than 3....so... it's weird it happened today without any action from me.
 
@smtalk maybe you have any idea what happened? or what informations (logs?) send to your developers? :)
 
Looking at the virtual_host2_sub.conf as a reference, the relevant lines are:
Code:
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|
|?REALDOCROOT=`HOME`/domains/`DOMAIN`/public_html|
...
<VirtualHost |IP|:|PORT_80| |MULTI_IP|>
|CUSTOM|
|?SDOCROOT=`DOCROOT`/`SUB`|
...
        DocumentRoot |SDOCROOT|
Where we did change to use SDOCROOT a while back in 1.59.5.

Going through your logic, the |*if SUB| check would be inserted into CUSTOM, just before the SDOCROOT is set and used..

The issue here is that REALDOCROOT might not exist yet in the tokens list, as we did re-order things slightly a while back.
The template file itself is read in after everything else, so it's assuming that the CUSTOM token is ready to go, and any tokens set inside the template would be set last, after all custom tokens are set.

In your case, the |REALDOCROOT| doesn't exist when CUSTOM is "tokenized".
However |HOME| and |DOMAIN| should be available, so you could use them instead of REALDOCROOT.

OR.. if you want to keep your code the same, you could use the template pre files. Assuming you want it for both private_html and public_html subdomains, create:
Code:
/usr/local/directadmin/data/templates/custom/virtual_host2_sub.conf.pre
/usr/local/directadmin/data/templates/custom/virtual_host2_secure_sub.conf.pre
with code:
Code:
|?REALDOCROOT=`HOME`/domains/`DOMAIN`/public_html|
or
|?REALDOCROOT=`HOME`/domains/`DOMAIN`/private_html|
for their respective files, so that the REALDOCROOT token is available when you're trying to read it. This does mean that any changes to REALDOCROOT might be affected, but I'm not seeing any in the DA code itself, so would only happen from customizations (aka: no relevant).

At the end of the day, the issue likely popped up due to changes in the read-order which were done to clean things up and make them more correct.
Let us know if the above virtual_host2_sub.conf.pre & virtual_host2_secure_sub.conf.pre changes don't work for you, and keep a close eye on the read-order that DA goes through when filled tokens and reading templates:

John
 
Back
Top