Directadmin + Custom Webroot for symfony

As a we are using directadmin for our webhosting machines we previously had problems with custom webroots.

The problem

Directadmin rewrites all uses httpd.conf files when adding/updateing subdomains or domain settings leading to a default httpd.conf, resulting in a blank page for symfony projects. (symfony projects use the /web) webroot.

Previous solution

The previous solution told you to update the symfony webroot directory, this way you went with the directadmin default configuration. (public_html document root). The downside of this solution was that your domain directory (/home/user/domain/mydomain.com) was a mess with directories like public_html, private_html, logs….

The final solution

Now i just bumped into a better & easier solution. Apperently directadmin ‘custom httpd configuration’ accepts the following tokens :
|DOMAIN|,
|IP|,
|HOME|,
|ADMIN|,
|DOCROOT|,
|USER|,
|GROUP|,
|CERT|,
|KEY|, |HOSTNAME|,
|SAFE_MODE|,
|OPEN_BASEDIR|,
|CREATOR|,
|BANDWIDTH|,
|QUOTA|Â

So for all your symfony projects you could update the documentroot right there (no manual httpd.conf configuration or changing the symfony webroot). Just add these 2 lines into your ‘custom httpd.conf’ for the selected domain :
1
2
Alias /sf /usr/local/lib/php/data/symfony/web/sf
|?DOCROOT=/home/USERNAME/domains/DOMAIN/public_html/web|
In the above example you should replace DOMAIN & USER by the variables you can find in the ‘contents of the httpd.conf file’ just below the custom httpd.conf configuration.

No comments:

Post a Comment