Mobile app version of vmapp.org
Login or Join
Annie201

: Can a later DocumentRoot directive override an earlier DocumentRoot directive? Because I use cPanel, the WHM developers are trying to restrict my subdomain creation to any folder within my user

@Annie201

Posted in: #Apache #DocumentRoot #Memory #Performance #Server

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)?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie201

1 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme