How can I edit httpd.conf and keep the modifications for good ?

SecondSight

Well-Known Member
Jun 30, 2004
70
2
156
Hello ! :)

I would like to make modifications to the httpd.conf file in order to make a few tests and find the best configuration.

In order to make the modifications I used SSH. But then I made changes in WHM, and the modifications I had made through SSH were not kept.

The values I want to modify are :
MaxKeepAliveRequests
KeepAliveTimeout

Is there a way to modify these values in WHM ?
I looked in Main >> Service Configuration >> Apache Configuration >> Global Configuration but didn't find MaxKeepAliveRequests and KeepAliveTimeout.

If I edit httpd.conf through SSH, how can I make sur the modifications will be kept in the future ?...

Thank you ! :)

Regards,

AJ PAYET
 

ChrisRHS

Well-Known Member
Jul 12, 2006
292
5
168
I would suggest for changes like that, that you use the Include Editors and place your setting within them. Those should be placed in the pre_virtual host, or, post_virtual host files. They can be accessed through WHM via:

Main >> Service Configuration >> Apache Configuration >> Include Editor

You can also access them via command line, the files are located:

/usr/local/apache/conf/includes/

Alternatively, you can use the distiller to update the httpd.conf:

/usr/local/cpanel/bin/apache_conf_distiller --update

I do suggest using the Include files though.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
The Include files is the preferred method for making and preserving the types of changes being discussed.
 

SecondSight

Well-Known Member
Jun 30, 2004
70
2
156
Hello ! :)

In fact, I'm making tests and I'm trying to find the best possible configuration for httpd.conf.

I've used the distiller to update the httpd.conf.

Why is the include files a better way ? :)

Thank you ! :)
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
We make no guarantees that configuration directives distilled from httpd.conf by apache_conf_distiller will be used for future regenerations of httpd.conf. Most of the time the distilled values are used, but not always.

The safest option is to use an Include file as we purposely leave the Include files alone.
 

SecondSight

Well-Known Member
Jun 30, 2004
70
2
156
Thank you for the explanations.

I don't know how to use include files.

I need to have these values in httpd.conf :
MaxKeepAliveRequests 50
KeepAliveTimeout 10

So, I go to : Main >> Service Configuration >> Apache Configuration >> Include Editor

I click on "Post VirtualHost Include", I select "All versions" in the list box, and I simply paste these two lines :
MaxKeepAliveRequests 50
KeepAliveTimeout 10

Then I click on the "Update" button, and that's all ?

Should I remove MaxKeepAliveRequests and KeepAliveTimeout from httpd.conf also ?

Thank you ! :)
 

SecondSight

Well-Known Member
Jun 30, 2004
70
2
156
Thank you for the explanations. I'm now using the Post VirtualHost Include file. :)