Question

Make Apache listen on Floating IP only

Our Digital Ocean Droplet has a regular IP address, and we also have a Floating IP address assigned.

I’d like Apache to only listen on the Floating IP address. So any requests that come to Apache via the Droplet’s regular IP address would go unanswered.

I have tried changing

Listen 80
Listen 443

to


Listen FLOATING_IP:80
Listen FLOATING_IP:443

However, Apache fails to start and the following error is in the log:


(99)Cannot assign requested address: make_sock: could not bind to address FLOATING_IP

I’m wondering if Floating IP addresses are re-written to the main Droplet IP address prior to the traffic reaching the Droplet?

Is it possible to achieve what I would like?


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.

Hi there @DigitalCarrot,

In order to achieve this, what you could do is use the Anchor IP address instead.

You can find the Anchor IP by running this curl command from the server itself:

curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address

For more information on Anchor IPs, you could take a look at the documentation here:

https://docs.digitalocean.com/products/networking/floating-ips/how-to/find-anchor-ips/

Hope that this helps! Regards, Bobby