Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Change IP Address for a cPanel Addon/Subdomain  (Read 4146 times)

0 Members and 1 Guest are viewing this topic.

lijeshk

  • Guest
How to Change IP Address for a cPanel Addon/Subdomain
« on: November 01, 2013, 08:33:40 am »

SSH into the cPanel server and browse over and edit to (replacing $user and $domain with user and domain you wish to modify) :

#vi /var/cpanel/userdata/$user/$domain.com

In this file you can modify the IP of the subdomain or addon domain.  The contents of the file will look like this:

---
documentroot: /home/user/public_html/sub1
group: user
hascgi: 1
homedir: /home/user
ip: <Old IP Address> #Replace Old IP Address with the desired IP
no_cache_update: 0
phpopenbasedirprotect: 1
serveradmin: webmaster@sub1.domain.com
serveralias: www.sub1.domain.com
servername: sub1.domain.com
usecanonicalname: 'Off'
user: user
userdirprotect: ''
---

Now you can change the IP to that of another IP on the server that is not being used:

#cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak

#/scripts/rebuildhttpdconf

#service httpd restart

You should be all set to use the new IP.  Just update your DNS manually to point to the proper IP.

 :)