Installing Virtualmin on Amazon EC2 at public IP address

SYSTEM INFORMATION
OS type and version Ubuntu 22 LTS
Virtualmin version Latest

Hi,
I have installed virtualmin successfully in Digital ocean and other VPS servers in the past but this time, I had to install virtualmin on an Amazon EC2 instance. The installer completed successfully but towards the end it showed me that I can access Virtualmin via https://172.31.58.196:10000

The problem here is, virtualmin picked the private IP address of the Ec2 instance [eth0] which is 172.31.58.196. However, the Ec2 server’s public IP is 5x.216.xx.23x (masked for security)

how do I change it to https://5x.216.xx.23x:10000 so that its publicly accessible over the internet? I can SSH to my server on 5x.216.xx.23x IP only and not 172.31.58.196

I cannot access virtualmin via the provided link as it’s not publicly accessible. all required ports included 10000 are open.

Alternatively, is there a way I can force virtualmin to install or use only the server’s public IP instead of the private IP on EC2?

I don’t think you need to change anything. It isn’t uncommon for systems to map external to internal ip addresses. I don’t think I had to do anything on my AWS install to get to VM. Just use https://5x.216.xx.23x:10000

EDIT: AWS does have a firewall you have to open ports on. Maybe that is your problem? 10000 to 10010 if I remember correctly.

1 Like

I have opened the ports but it’s still not accessible :frowning:

Is there any config file that can be edited so that virtualmin knows that server’s correct IP address is 5x.216.xx.23x and not the private IP 172.31.58.196?

Here’s what mine has. Note, no external IP listed. I don’t know that webmin/vm listens to a single address.

I believe 0.0.0.0 is a wildcard for all addresses. It just cares about the port.
tcp 0 0 0.0.0.0:webmin 0.0.0.0:*

What error do you get?

I get no error. When I try to access it via the web browser, it just keeps loading and times out.

I’d double check the Amazon stuff. My instance is the Lightsail. The default leaves ports 80, 443 and 22 open. Everything else is closed. This sure sounds like an AWS firewall problem to me.

You do not need to change anything in Virtualmin in order to login. It listens on all IP addresses, by default, and it does not need to know about the public IP for you to login to Virtualmin.

That said, you probably do need to configure Virtualmin to know about your public IP, if you’ll be hosting DNS locally, since that’s the IP that needs to appear in the records. But that has nothing to do with logging in.

If you can’t login, and if Virtualmin (webmin service) is running, then the problem is connectivity, and it probably is the Amazon firewall (which you can’t configure within the server itself, and Virtualmin has no control over).

Looks like the problem was with EC2 firewall. Basically turning off firewall allowed me to access Virtualmin interface. I did open port 10000 to 10010, 80, 443 and 22. But that didn’t solve it. So opening all ports helped though.

I also set up an elastic IP just to be safe.

Thanks for the help guys!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.