I'm trying to host a small node application on a digital ocean droplet running ubuntu 14.04. In local development the site works fine over https, however on the server the site doesn't get displayed and the server does not throw an error, the connection is just refused. I ran nmap localhost
and port 443 was closed. How can I open it?
4 Answers
sudo ufw allow 443/tcp
And have a read through the docs on Ubuntu UFW interface on iptables. This should open it for your web application.
Also make sure that your application is serving off the external IP as well as the internal. The app.js file there is usually a setting to specify a interface for it to run on. 0.0.0.0 should run it on both internal and external.
-
2When I run
sudo ufw status verbose
it says inactive. Should Isudo ufw enable
? Because it's inactive it isn't the thing that's closing the port then right?– WilfredJul 20, 2014 at 14:38 -
allow 443/tcp
also lets AWS command-line tools work. Thanks! requester.mturk.com/developer/tools/clt Jul 20, 2017 at 16:55
On Ubuntu 18.04.1 LTS I was missing this command:
sudo a2enmod ssl
Among other things, this will actually enable the ssl module.
Hat tip to this thorough source for configuring SSL on Apache on Ubuntu: https://www.maketecheasier.com/apache-server-ssl-support/
This is what worked for me. 1) Create and install 2 certificates to /etc/ssl/certs/server.crt and /etc/ssl/private/server.key: https://help.ubuntu.com/14.04/serverguide/certificates-and-security.html
2) Edit the file /etc/apache2/sites-available/default-ssl.conf to reference those certificates and execute a2ensite on that file: https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
sudo ufw allow out 443/tcp
is necessary to allow outgoing connections from installed apps.