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

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.

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.