multiple ip addresses with Virtualmin on ec2, and remote MySQL on Webmin

I have Virtualmin running on EC2. IP addresses are associated via VLC. Is it possible to use several different IP addresses, so I can run several SSL certificates & websites?

How do I properly specify networking? Here is my current network interfaces setup:

eth0 Ethernet From DHCP From DHCP
eth0:0 Ethernet (Virtualmin) 54.236.104.50 255.255.254.0
eth0:1 Ethernet (Virtual) 54.236.84.128 255.255.254.0
eth0:2 Ethernet (Virtual) 54.236.101.156 255.255.254.0
eth0:3 Ethernet (Virtual) 54.236.109.76 255.255.254.0
lo Loopback 127.0.0.1 255.0.0.0

Apache works, but only if I set NameVirtualHosts: *:80, or internal IP 10.0.0.XX And I have to set each virtual host the same: *:80 or 10.0.0.XX

Additionally, I use a remote Webmin MySQL server on a separate EC2. For virtual hosts to work properly, I have to set the hostname of the Virtualmin to 10.0.0.XX, so vhost user will get connection & permissions to their database.

I have it all working properly except for being able to use all of the IP addresses... they all route properly and I have 2 virtual hosts working... but I would like to be able to utilize 5 IPs on this server to run several SSL hosts.

How can I make this work more like a similar setup on VPS?

Status: 
Closed (fixed)

Comments

In this case, you would have to create each domain that you want to run SSL on configured to use a different IP address - these would have to be the IPs actually assigned to eth0:N on the EC2 instance. If these IPs differ from the addresses that are externally visible (as is usually the case with EC2), you would need to set the "External IP address" on the domain creation form to the matching external IP.

That solves the SSL issue, but what about the correct hostname to use on the Virtualmin instance, so it creates the correct user permissions on the Webmin MySQL instance... or where do I configure what gets passed to the MySQL server when a virtual host is created on Virtualmin?

You can control which remote hosts are granted access to newly created MySQL databases at System Settings -> Server Templates -> Default Settings -> MySQL Database -> Allowed MySQL client hosts.

Mmmm... that would work if the MySQL server is running Virtualmin... but it's running Webmin.

Setup: Virtualmin Apache PHP server connected to Webmin Remote MySQL server inside VPC.

Maybe I did this wrong and you can suggest a better way?

I'm using a separate MySQL server because I want to connect various Virtualmin and/or Webmin servers to it. For clients with several virtual hosts, I would use Virtualmin, sometimes with NginX, sometimes with Apache and ELB Varnish instances in front. For single-domain clients I would use Webmin+Apache or Webmin+NginX, connected to the MySQL server. I find it easier to optimize, build out and snapshot a MySQL server vs. managing MySQL on a bunch of different Virtualmin instances.

Maybe I need to get a Cloudmin license and begin learning to handle my builds in that environment?

I feel like I have plenty of experience with bare metal and VPS Virtualmin + Webmin, but I'm relatively new to running them on AWS.

I think I'm getting it. I have Virtualmin creating databases on the remote Webmin MySQL, so if I change the default template to include the Virtualmin instance's IP, internal and external hostnames, it should work properly.

I apologize for being so needy... I had this working on a previous AWS buildout, but it did not use VPC because at that point, VPC did not exist.

Yes, that is correct .. the setting is on the Virtualmin side, not on the remote Webmin / MySQL system. However, the allowed IPs end up being configured on the MySQL system.

My test for success would be for a script install to complete:

Now installing WordPress version 3.5.1 .. Database connection failed : DBI connect failed : Access denied for user 'veloguru'@'10.0.0.32' (using password: YES) 1361.

In Virtualmin's Default Server Template, I have Allowed MySQL client hosts: 10.0.0.32,ip-10-0-0-32.ec2.internal,vm5.vacantserver.net

http://veloguru.com loads up just fine, and I have figured out the VPC NAT and IP addresses, thanks for that.

Do I need to change the Allowed MySQL hosts to only 10.0.0.32 ? I was trying to cover the bases by adding the internal and external hostnames.

Yes, that's it! just the one IP address for the allowed hostnames, and it works now.