SOLVED Modify apache config file directly

gentlemedia

Member
Jul 15, 2017
11
1
3
Greece
cPanel Access Level
Root Administrator
Hi,

I need to add the following to my apache config file:

Code:
<Directory /path/to/your/home/public_html/>
    Options FollowSymLinks MultiViews Includes Indexes
    AllowOverride All
    Require all granted
</Directory>
I have 2 questions regarding this
  1. How do I figure out what the full path is to my public_htme folder
  2. In which config file do I add this block?
The 2nd question I think I do already know the answer, but I'd like to get this confirmed. For the record I have WHM/cPanel on CentOS 7.

I have read the docs about the risks when modifying httpd.conf directly
Advanced Apache Configuration - EasyApache - cPanel Documentation

When I opened the httpd.conf file with nano /usr/local/apache/conf/httpd.conf I read a comment at the WHM/cPanel comment section that is not mentioned in the documentation. The steps in the documentation to modify it directly are more complex than what the comment says.
# Administrator location to safely altering httpd.conf
include "/etc/apache2/conf.d/includes/pre_main_global.conf
When I open that file with nano it is completely empty, so can I just add my modifications in this file, restart Apache and be done with it? :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Hello,

The default path to the public_html directory is the following by default:

Code:
/home/$username/public_html/
You'd replace "$username" with the username of the cPanel account the domain name is associated with. As far as setting up that entry for a specific domain name, you can follow the steps and examples outlined on the following document:

Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

I have read the docs about the risks when modifying httpd.conf directly
Advanced Apache Configuration - EasyApache - cPanel Documentation
These are older instructions for use with EasyApache 3. The updated document for EasyApache 4 is available at:

Advanced Apache Configuration - EasyApache 4 - cPanel Documentation

Thank you.