How can I bind a process to a floating IP?

Posted August 22, 2018 5.9k views

How can I bind a process(i.e. Web server) to a floating IP address? I want to configure NGINX to listen only on the floating IP. However, Ubuntu doesn’t detect the floating IP at all, and NGINX gives an error whenever I try:

nginx: [emerg] bind() to floating_ip:443 failed (99: Cannot assign requested address)

The config I’m using is:

        listen floating_ip:443 ssl;
        ssl_certificate /var/www/;
        ssl_certificate_key /var/www/;
        location /{
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            #proxy_set_header scheme $scheme;
            proxy_set_header X_FORWARDED_PROTO $scheme;
1 comment

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.

Submit an Answer
1 answer

Thanks to X40C for finding this:

The answer already exists here.


Run the following from your droplet to find the IP to bind to:

curl -s