The fix-web-vhost-configuration Script
Valid for versions 82 through the latest version
Version:
82
Last modified: 2022 November 29
Overview
You can use the /usr/local/cpanel/scripts/fix-web-vhost-configuration script to iterate through each user’s web virtual host configuration files and remove excess alias names. Certain historical errors in cPanel & WHM make it possible for discrepancies to exist between what the system expects and the actual configuration.
- 
You must run this script as the
rootuser. - 
The system automatically runs the
/usr/local/cpanel/scripts/fix-web-vhost-configurationscript when you upgrade major versions of cPanel & WHM. 
This script performs the following actions:
--dry-run argument, the script will not delete or add any domains form the web virtual host configuration files.
    - 
Identify any unrecognized alias domains.
 - 
Delete the following unrecognized alias domains from the web virtual host configuration files:
- 
Active service subdomains -
cpanel.example.com - 
wwwsubdomains of active service subdomains -www.cpanel.example.com - 
wwwsubdomains of any expected alias -www.mail.example.comNote:This will ignore other unrecognized alias domains 
 - 
 - 
Identify and add any missing alias domains.
 
Run the script
To run this script on the command line, use the following format:
/usr/local/cpanel/scripts/fix-web-vhost-configuration [arguments]Options
Use the following options with this script:
| Options | Description | Example | 
|---|---|---|
--user | 
Required - Update the web virtual host configuration files of the user that you specify. 
 Note: 
    
        You must pass either the  
user flag or the all-users flag, but not both.
     | 
--user=username | 
--all-users | 
Required - Update the web virtual host configuration files for all users.   
 Note: 
    
        You must pass either the  
user flag or the all-users flag, but not both.
     | 
--all-users | 
--dry-run | 
Identify, but do not delete or add any alias domains in the user’s web virtual host configuration files. | --dry-run | 
--help | 
Display a help message. | --help | 
Example
For example, the following command removes the excess alias name from the username cPanel user’s web virtual host configuration files:
/usr/local/cpanel/scripts/fix-web-vhost-configuration --user=usernameOutput
This script’s output could resemble the following example:
 | 
 |