Configuring automatic domain syncing with cPanel
Since version 1.6.2, network admins hosting their network over a cPanel install no longer need to manually add mapped domains to the Add-on Domains panel. This tutorial will go over the necessary steps to configure this integration on your WP Ultimo network install.
Adding the config to your wp-config.php file
You’ll need to edit your wp-config.php file to include the custom configuration constants WP Ultimo needs to correctly connect to the cPanel API.
Add the following lines to your wp-config.php file, right above the /* That’s all, stop editing! Happy blogging. */ line. Replace the contents with the information obtained in the prior steps:
/* WP Ultimo: Adding automatically domain syncing to cPanel */
define('WU_CPANEL', true); // Tells WP Ultimo we should connect to cPanel
define('WU_CPANEL_USERNAME', 'username'); // The username you use to login on your cPanel
define('WU_CPANEL_PASSWORD', 'password'); // The password you use to login on your cPanel
define('WU_CPANEL_HOST', 'mi3-ss19.a2hosting.com'); // The URL of the cPanel hosting, do not include the port or the protocol (http or https)
define('WU_CPANEL_PORT', 2083); // (Optional) Port number, if different than 2083
/* end WP Ultimo */
IMPORTANT: Some hosts will say your cPanel URL is yourdomain.com/cpanel. They do that for your convenience, but that URL is just a redirect to the real cPanel URL (which is usually something like yourdomain.com:2083). If that’s the case, put only yourdomain.com as the WU_CPANEL_HOST value. The number after the “:” is the port (yourdomain.com:2083). If, in your case, that number is different from 2083, you’ll need to pass that as well using the WU_CPANEL_PORTconfig.
After replacing the values, you should have something like this:
You’re all set!
Now, every time a new domain is mapped in the network (via the Aliases tab by the network admin or via the custom domain meta-box on the user’s Account page) it will be added to the cPanel’s Add-on Domains page automatically.
The same is true for domain removals. Every time a domain is deleted from the network, that change will be communicated to your cPanel account instantly!
Important: Changing the root directory of the add-on domain
This is not the case for the majority of cPanel installs, but if for any reason your network is not located on the /public_html directory of your install, you need to let WP Ultimo know about that, otherwise the add-on domains will be added pointing to the wrong place.
To do that, simply add the following definition below the other ones you have added before, changing the /public_html value with to the directory where your network is located (ex.: “/my_sub_dir_where_the_network_is“).
If for any reason the domains are not being automatically added to your cPanel after this setup, head to WP Ultimo > System Info > Logs and search for the cpanel.log file (not the cpanel-cookie.log). Errors like wrong credentials or access denied get saved to that file when they happen.
Common Messages and their respective fixes
Below you'll find a list of common error messages that you might find on your cpanel.log file and how to address them.
Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.
This message means that your cPanel server is configured to only accept domains that are configured to use your cPanel's nameservers.
To fix that, log into your WHM account, go to Tweak Settings and search for these:
Allow Remote Domains [?]
Allow creation of parked/addon domains that resolve to other servers (e.g. domain transfers) This can be a major security problem. If you must have it enabled, be sure not to allow users to park common Internet domains.
Allow unregistered domains [?]
Allow creation of parked/addon domains that are not registered.
Simply change both of these options to “On“, and then click the “Save” button in Tweak Settings area.