Question

Multiple public IPs on a Droplet?

I host a handful of websites for friends and projects of mine. None of them is particularly resource-intensive, but they’re not all the same thing. A few are static sites served by Nginx, one is a Javascript Wiki, one is Mastodon, some are bespoke servers I’ve written in Swift.

I’d love to containerize these on a single slightly bigger Droplet than having a handful of small Droplets. But in order to allow multiple services to respond on port 443, I need to assign multiple public IP addresses to the one Droplet. Can this be done?

Alternatively, I’m thinking of reverse-proxying everything through a single Nginx service, and maybe even letting Nginx handle all the SSL. It can then route requests based on hostname (at least, I think this is a viable approach). It’s bit more complex than I’d like in terms of configuration, in that I have to coordinate the container config with a change to the Nginx config, so I think I still prefer having multiple IP addresses.

BUT: I don’t know if it’s even possible, and I don’t know if that will cost so much that it would wipe out any savings I get from consolidating Droplets in the first place.

I’d consider going IPv6-only, too, if someone could reassure me I wouldn’t become too inaccessible to the rest of the world.

Thoughts? TIA!


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.

KFSys
Site Moderator
Site Moderator badge
February 21, 2024

Heya @jetforme,

Droplets come with a single IP address however you can also attach 1 extra reserved IP address as described here:

https://docs.digitalocean.com/products/networking/reserved-ips/

As for allowing multiple services to respond on ports 443 and 80, you can use Nginx as a reverse proxy, that is the standard way and I’ve used it all my life without any issues. So rather than spending money on different Droplets and reserved IP addresses, just use Nginx as a reverse proxy and proxy requests on port 80 and 443 to the internal ports your apps are using.

Bobby Iliev
Site Moderator
Site Moderator badge
February 21, 2024

Hey!

Each Droplet comes with a single public IP address, you can also attach 1 extra reserved IP address as described here:

https://docs.digitalocean.com/products/networking/reserved-ips/

However there is no need to have multiple public IP addresses in order to host multiple websites. Your alternative idea of using Nginx as a reverse proxy is a widely adopted solution for hosting multiple services on a single server (or Droplet). Nginx is very efficient at handling SSL termination and can route traffic based on the hostname to different backend services, regardless of whether those services are containerized or run directly on the host:

https://www.digitalocean.com/community/questions/how-to-host-multiple-docker-containers-on-a-single-droplet-with-nginx-reverse-proxy

Going IPv6-only could significantly limit accessibility for your services. Despite the growing adoption of IPv6, a significant portion of the internet (including many residential ISPs and older corporate networks) does not fully support IPv6. This could make your services inaccessible to a portion of your audience. It’s generally recommended to support both IPv4 and IPv6 where possible.

Let me know if you have any questions!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel