Question

How do I update the DO Docker droplet to enable ports 80 and 443?

I have set up new droplet using the DO droplet (https://marketplace.digitalocean.com/apps/docker. The documentation says that the default firewall for the Docker One-Click is UFW, but I can’t find a way easily enable ports 80 and 443.


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.

Accepted Answer

Hi @bsscdt ,

Try this command:

docker run -p 80:80 -p 443:443 --name nginx -d nginx

The --name should be the name of your docker container.If you don’t pull nginx yet,also run this before the command I mentioned to mapping 80/443 ports:

docker pull nginx

Regards, Shiroka

this may help…

Step 5 — Allowing Other Connections

At this point, you should allow all of the other connections that your server needs to respond to. The connections that you should allow depend on your specific needs. You already know how to write rules that allow connections based on an application profile, a service name, or a port; you already did this for SSH on port 22. You can also do this for:

  • HTTP on port 80, which is what unencrypted web servers use, using sudo ufw allow http or sudo ufw allow 80
  • HTTPS on port 443, which is what encrypted web servers use, using sudo ufw allow https or sudo ufw allow 443
  • Apache with both HTTP and HTTPS, using sudo ufw allow ‘Apache Full’
  • Nginx with both HTTP and HTTPS, using sudo ufw allow ‘Nginx Full’

from https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04

Try DigitalOcean for free

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

Sign up

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.