How do you configure Floating IP and Virtualmin properly so each virtual host is loaded correctly?

I’m using CentOS 6.9 with Virtualmin installed as my app server. The server also has PHP installed. It serves multiple virtual hosts. It’s been working well for the past 2 years.

I’m trying to use Floating IP. I already followed the guides from DigitalOcean and the floating ip already points to proper anchor ip and works well. However, it keeps loading the default documentroot from httpd.conf and it doesn’t even load PHP files now.

I already made sure that all the IP addresses in “ip addr sh” match those in “grep -i ‘<virtualhost’ /etc/httpd/conf/httpd.conf”.

Am I missing something?

Any help is appreciated. Thanks.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I set mine to “any” in the Apache Virtual Server for each one, and when I then test by using my hosts file on my computer to point to the floating IP for a virtual server hostname, it then loads correctly and my traceroute shows the proper floating IP to verify too. I think like stevens said, setting it to * (or “any”) will do the trick.

I’m personally now looking to see how I can make sure this also works for the mail servers too. I guess that’d just be a simple DNS change though pointing to the floating IP.

Hi ryan, thanks for the reply.

Actually, I used anchor IP and it didn’t work. I also tried changing it to floating IP and that didn’t work either.

However, I found a workaround by specifying * on port 80 and 443 in addition to the other vhost configuration. It works fine now.


Sorry you’re having trouble. One thing to keep in mind when working with floating IPs is that your droplet will never see the public floating IP used to request it. Your droplet will see all requests for the floating IP coming from the anchor IP and this anchor IP needs to be reflected in your Apache configuration. It sounds like everything is working properly but Apache is not routing the request properly to the correct Virtualhost.

Are all your VirtualHost configurations stored within your main httpd.conf file? On most modern distributions of Apache, virtualhosts are configured in individual files in /etc/httpd/sites-enabled/ - be sure that any hosts that need to listen for requests from the floating IP are listening on your anchor IP.