Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

API or Script to edit apache configuration

Tim Duncan shared this idea 6 years ago
Completed

As a cPanel System Administrator, I would like to be able to use a script or API call to modify apache configuration settings located inside /var/cpanel/conf/apache/local instead of having to edit this via WHM or manually via SSH, so that we can automate apache settings across multiple WHM servers. This would give us the ability to configure things such as 'Perfect SSL secrecy' etc via automated scripts.

Replies (2)

photo
1

If you are wanting all of your server's Apache configs to be the same, why not just copy the /var/cpanel/conf/apache/local file across all of your servers and rebuid apache with /scripts/rebuildhttpdconf ?


You can also parse /var/cpanel/conf/apache/local as a YAML file (see the YAML extension in PHP - yaml_parse() - to parse the contents into a usable array.

photo
3

The request here is for an API call, which would ensure long-term compatibility. Manually copying files could have problems if we change how or where a configuration is managed.

photo
4

Benny is spot on!

Copying the files is not a valid solution for us, as each server will most likely need different configuration. We could write custom scripts using 'sed' for example, but if the file format is ever updated these scripts would break, which is why a supported API call would be ideal.


cPanel already has scripts/API calls to update SSL ciphers for example in dovecot, exim, whostmgrd, etc, but not Apache which I thought was strange.

We also don't want to have to use PHP in system admin tasks..

:)

photo
photo
2

Since "/var/cpanel/conf/apache/local" in cPanel 84 is deprecated our automated deployment will be broken. We need some way to change apache configuration without human intervention.

Leave a Comment
 
Attach a file