How to change site visible when WHM hostname is opened in web browser?

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Hello,

currently when i open WHM server hostname or IP in the web browser, it redirected to the website of the cpanel that was added as the first cpanel to the shared IP in WHM.

When i moved this cPanel to secondary IP, then another website taken place.

But how can i please set website/domain/URL of my choice to open when WHM hostname or IP is opened in web browser?

Thank you

-----
update: i had to change IP of my WHM/cpanel VPS; i modified IP in "Basic cPanel & WHM Setup" but seems that my old IP is still 4 times in /usr/local/apache/conf/httpd.conf :

# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.
NameVirtualHost OLDIP:443
NameVirtualHost OLDIP:80
NameVirtualHost *
# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost OLDIP:80>
ServerName OLDIP
But seems that was not enough, where i should modify IP so it propagate httpd.conf ?
 
Last edited:
  • Like
Reactions: sandra lynn

postcd

Well-Known Member
Oct 22, 2010
717
19
68
@Michael
thx for a reply on that page i found this post of yours, it worked, BUT i would like not to "hardcode" IP into the configuration as IP may change. How can i do it?

Also i wish you can reply also regarding the issue (i described above) where old IP was not replaced by new in httpd.conf
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello,

How do you plan on making a change to the IP address? It should be replaced with the new IP address automatically if you use "WHM >> IP Migration Wizard" when making the change.

Regarding the old IP address, did you take any steps to remove the old IP address from the server? Does it exist in the /etc/ips file, or within any files under the /var/cpanel/userdata/$username/ directories?

Thank you.
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Thx, i just changed IP in "Basic cPanel & WHM Setup" and then did "Multi Account Functions" > Change Multiple site's IP addresses
So as you suggested now i ran that "IP Migration Wizard". It completed without error:
Switching domain forwarder ip...Done
Merging httpd.conf ....Done
Updating cPanel userdata....... Done
Updating ssl domains.... Done
Apache Web Server...Apache successfully restarted....Done
Updating cPanel users files..Done.
Updating userdata cache.... Done.
Your config files have been updated. Press continue to update DNS entries...
The DNS migration has been completed on this server.
Once the DNS changes have propagated, you can complete the migration by "Clicking Here" --- and i have not yet clicked that button
Old IPs in /usr/local/apache/conf/httpd.conf was replaced by new, but it is there twice on many lines:
<VirtualHost NEWIP:443 NEWIP:443>
<VirtualHost NEWIP:80 NEWIP:80>

I think it may be result that i ran this Wizard while cpanels had already been assigned new IP (by doing mentioned "Change multiple site's IP addresses" from within WHM). Is that problem? If yes, how should i fix that? Is enough to do replacement just in this file or fix in WHM anyhow? PS: shouldn't cPanel try to configure Wizard so this do not happen?

Update: i clicked button to finish migration and after it restarted apache, all sites was showing Error 500, then when i run "/scripts/rebuildhttpdconf" from within command line and restarting apache (service httpd restart), sites started working again.

Yet there is still the question of this topic regarding hostname/WHM IP, how to define custom site/redirect without hardcoding present IP into httpd.conf virtualhost include?
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
<VirtualHost NEWIP:443 NEWIP:443>
<VirtualHost NEWIP:80 NEWIP:80>
Hello,

It's normal to see two VirtualHost entries for an IP address. One is for port 80 (Non-SSL), and the other is for port 443 (SSL).

Thank you.
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
i know, but i think (may be wrong) problem is when IP is two times on same line:
GOOD: <VirtualHost NEWIP:443>
BAD: <VirtualHost NEWIP:443 NEWIP:443>

there is still the question of this topic regarding hostname/WHM IP, how to define custom site/redirect without hardcoding present IP into httpd.conf virtualhost include?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Could you verify if your system uses EasyApache 3, or EasyApache 4?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look. You can post the ticket number here and we will update this thread with the outcome.

Thank you.