1

Because I use cPanel, the WHM developers are trying to restrict my subdomain creation to any folder within my user account of /home/username.

In order to improve processing speed, I created a ram drive at /ram and I want to host all my files there. I created a symbolic link named memory in /home/username.

Currently my apache configuration file contains:

DocumentRoot /home/username/memory/public_html
include /home/username/configuration.conf

then in /home/username/configuration.conf I have:

<Directory "/home/username/memory/public_html">
# insert rewrite rules here as it applies to site
</Directory>

This setup works OK but according to program tracing, numerous stat calls are made to check the validity of the symbolic link and to walk up the parent directories and if I can eliminate those per request then I'd have a faster web server.

Because the method to set document root to a path outside of the /home folder for multiple sub-domains is to edit multiple files in the cpanel folder, the process is tedious.

Because the root apache configuration will eventually be overwritten by WHM/cpanel, I'm thinking of modifying /home/username/configuration.conf to this:

DocumentRoot /ram/public_html
<Directory "/ram/public_html">
# insert rewrite rules here as it applies to site
</Directory>

If I do it, would the actual document root be overwritten to point to the actual memory folder of (/ram/public_html) and will the output be the same? or do I have to take extra steps to ensure my site is being served directly from a RAM folder (not from a symbolic link)?

2
  • 1
    A later DocumentRoot directive will override an earlier directive.
    – MrWhite
    Jan 19, 2016 at 10:25
  • 1
    @w3dk that sounds like an answer. If you could back it up with documentation, testing, or experience, put it in the answer field. Feb 23, 2016 at 15:04

1 Answer 1

1

I tried overriding DocumentRoot "/path/to/new" in an included conf file outside httpd.conf and it seems to work great. This was for Apache 2.4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.