Assign Dedicated IP Address to Subdomain or Addon Domain

1. Edit your subdomain or addon domain configuration file:

nano -w /var/cpanel/userdata/usuario/subdomain.domain.com

Content should be similar to this:

customlog:
 -
 format: combined
 target: /usr/local/apache/domlogs/cpaneltips.com
 -
 format: "\"%{%s}t %I .\\n%{%s}t %O .\""
 target: /usr/local/apache/domlogs/cpaneltips.com-bytes_log
documentroot: /home/username/public_html
group: Group1
hascgi: 1
homedir: /home/username
ip: 192.168.0.1
owner: username
phpopenbasedirprotect: 1
port: 80
scriptalias:
 -
 path: /home/username/public_html/cgi-bin
 url: /cgi-bin/
 -
 path: /home/username/public_html/cgi-bin/
 url: /cgi-bin/
serveradmin: webmaster@cpaneltips.com
serveralias: www.cpaneltips.com
servername: cpaneltips.com
usecanonicalname: 'Off'
user: username
userdirprotect: ''

2. Edit the IP line and add your new IP, as you see below:

ip: 0.0.0.0

Save the changes now.

3. Rebuild and restart Apache to apply changes:

/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_apache

4. Edit the A registry at the DNS records for the subdomain/domain chosen, and add the new IP address. You can do this from WHM > Edit DNS Zone.

5. Finally, mark your IP as reserved from WHM > Show/Edit Reserved IPs

Tags: