Problem with Apache Configuration File !

St493r

Member
Feb 5, 2012
6
0
51
cPanel Access Level
Website Owner
Hi

When I want to change apache configuration , Example change , +indexes to -indexes I got an error like :
Changes to these settings do not take effect until the main Apache configuration file is rebuilt.

Then all web site of my server got 403 forbidden error

I edit /usr/local/apache/conf/httpd.conf and change -symlinkifownsermatch to +symlinkifownermatch

Later again i got 403 forbidden and when i open httpd.conf i see symlinkifownermatch is - againe automaticly !

What i can do?!

Execusme because bad english

Regards
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Can you please show what you are putting in this section of /usr/local/apache/conf/httpd.conf file?

Code:
<Directory "/">
    Options All
    AllowOverride All
</Directory>
I know it isn't Options All, but we really do need to see exactly what you have there for testing purposes.

Of note, if you make changes there, you would need to run the distiller:

Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
You would then need to rebuild Apache and restart it:

Code:
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Prior to making any of these changes, please make a backup copy of httpd.conf file:

Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak120205
 

JayFromEpic

Well-Known Member
Apr 2, 2011
218
8
68
Scottsdale
cPanel Access Level
Root Administrator
Twitter
If you are just a website owner, I highly suggest you contact a Server Administration company to do this for you. When changing the settings of Apache, it is extremely easy to mess it up and cause all of the websites on the server to go down.

For one, once you make these changes to the apache config file, simply recompile it apache. Your best bet is to simply look over the official installation file for apache at Compiling and Installing - Apache HTTP Server.

You can also try Easy Apache located in WHM but im not entirely sure if it will overwrite any configuration changes.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Without root access, this user couldn't have edited Apache configuration as was being mentioned in their initial post. Linking to the installation instructions for Apache outside of the cPanel system could potentially break this user's server if they do have root access.

My reply would be the correct way to edit httpd.conf and retain changes under cPanel system. The distiller works to maintain changes outside the VirtualHost section.
 

St493r

Member
Feb 5, 2012
6
0
51
cPanel Access Level
Website Owner
I have root access and this code is httpd.conf :

<Directory "/">
Options -ExecCGI -FollowSymLinks -Includes -IncludesNOEXEC -Indexes -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
</Directory>


but automaticly +SymLinksIfOwnerMatch change to -SymLinksIfOwnerMatch and all web sites got 403 forbidden error !

regards
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
I am unable to get the distiller to allow that specific portion to update with the settings you've noted. You are probably going to have to copy /var/cpanel/templates/apache2/main.default to /var/cpanel/templates/apache2/main.local and then revise this portion:

Code:
<Directory "[% main.maindirectory.item.directory %]">
    Options [% main.directory.options.item.options %]
    AllowOverride [% main.directory.allowoverride.item.allowoverride %]
</Directory>
Simply change to the following:

Code:
<Directory "[% main.maindirectory.item.directory %]">
Options -ExecCGI -FollowSymLinks -Includes -IncludesNOEXEC -Indexes -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
</Directory>
At that point, re-run "/scripts/rebuildhttpdconf" and see if the changes show up there. If they do, try restarting Apache. If you have issues with the change, you would have to move main.local out of the way to get the regular main.default file to load again with another "/scripts/rebuildhttpdconf" command.

Please ensure that backup copy of httpd.conf is created prior to making these changes.
 

Infopro

Well-Known Member
May 20, 2003
17,075
524
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
Hi

When I want to change apache configuration , Example change , +indexes to -indexes
...
Just out of curiosity, whats the purpose behind changing this to use - instead of + like you're hoping to do?

In WHM > Service Configuration > Apache Configuration > Global Configuration, Directory “/” Options, you can check or uncheck these options and save. In doing so httpd.conf is rebuilt, Apache restarted and these values are added or removed from httpd.conf

They are not changed from - to + or visa versa, so I'm curious of the need for the - instead of the +
 

Infopro

Well-Known Member
May 20, 2003
17,075
524
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
if I leave all variables set to the cPanel marked Defaults and save/rebuild, this section of httpd.conf looks like this:

Code:
<Directory "/">
    Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes SymLinksIfOwnerMatch
    AllowOverride All
</Directory>
If I uncheck SymLinksIfOwnerMatch save/rebuild I end up with this instead:

Code:
<Directory "/">
    Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes
    AllowOverride All
</Directory>
Reading this I don't understand what you're hoping to do:
Apache Performance Tuning - Apache HTTP Server

..so wanted to ask to have you clarify a bit more if possible to better understand the need in whatever it is you're hoping for here.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
It doesn't change to - if you use the steps I've noted. I tested what I suggested prior to providing my reply. If you truly do need the options you've mentioned with + or - for them, then have you tried what I suggested above yet?