Cpanel Server Behind NAT – Amazon EC2

When your cpanel server is behind nat, for example Amazon EC2 where you have an internal IP and External IP.

Go to

Home > Server Configuration> Basic WebHost ManagerĀ® Setup

Enter your servers internal IP where it ask for “The IPv4 address (only one address) to use to set up shared IPv4 virtual hosts.”.

Now login to Server using SSH and run

/scripts/build_cpnat

For an Amazon EC2 server with internal IP 172.31.26.120, i added the IP in WHM > Basic WebHost ManagerĀ® Setup

Run command /scripts/build_cpnat

That associate the IP with external IP address.

[root@ip-172-31-26-120 ~]# /scripts/build_cpnat
info [build_cpnat] 172.31.26.120 => 13.210.58.114
[root@ip-172-31-26-120 ~]#

This allow DNS and Apache to resolve external IP properly. With out running this command DNS server will just reply with servers internal IP address.

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *