By stevens
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.
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!
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.
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.
Thanks.
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.