The rebuildhttpdconf Script

Valid for versions 82 through the latest version

Version:

82


Last modified: January 20, 2022

Overview

You can use the /usr/local/cpanel/scripts/rebuildhttpdconf script to rebuild Apache’s main configuration file.

Important:
This script does not restart Apache. To restart Apache, run the restartsrv_httpd script.
Note:
The system automatically updates Apache's configuration as needed, so you may not need to run this script manually at all.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/scripts/rebuildhttpdconf --preview --nolock

Options

Use the following options with this script:

Options Description Example
--preview Creates a file named httpd-preview.conf instead of httpd.conf. This allows you to inspect the configuration file before you use it on your system. /usr/local/cpanel/scripts/rebuildhttpdconf --preview
--nolock Usually, the system locks the configuration file during the rebuilding process to prevent two processes from conflicting. This option disables that lock. /usr/local/cpanel/scripts/rebuildhttpdconf --nolock

Success

If the script succeeds, it will return output similar to the following example:

1
2
3
4
5
6
7
8
9
# /scripts/rebuildhttpdconf
...
info [rebuildhttpdconf] Missing IP for domain install.example.com, using 192.168.0.20
info [rebuildhttpdconf] Missing ServerName for domain install.example.com, using install.example.com
info [rebuildhttpdconf] Missing port for domain install.example.com, using 80
info [rebuildhttpdconf] Missing user for domain install.example.com, using nobody
info [rebuildhttpdconf] Missing owner for domain install.example.com, force lookup to root
info [rebuildhttpdconf] Missing group for domain install.example.com, using nobody
Built /etc/apache2/conf/httpd.conf OK

Additional Documentation