-1

So I have an Apache server running on port 443 and NodeJS installed on the latest version of Ubuntu. Now I have everything running perfectly, except that there is no SSL on the port I am running my NodeJS server on, port 100.

When I switch it to port 80 and run the server via sudo, it gives an error, so I certainly can not do that. Is there any solution to be able to have LetsEncrypt SSL coverage on ports other than 443 and 80?

Adam S.
  • 305
  • 1
  • 3
  • 14

2 Answers2

2

Port 80 is the standard port for http (without encryption).

Port 443 is the standard port for https (with encryption).

By standard port I mean web browsers know about these ports and so do not expect you to explicitly give the port. So https://www.example.com and https://www.example.com:443 are the same but because you are using the standard port there is no need to include the :443 part as the browser will do it for you.

You can have SSL on any port as its completely independent of the port though there are these standard conventions. Typically you would never have SSL on port 80 for example as that would break these conventions.

So if you want to use you NodeJS service over port 100 then you can but you'll need to explicitly state that port in the URL as well as the https protocol.

LetsEncrypt doesn't give a damn which port you use (except for the verification piece where it puts a file on a place contactable by the outside world to prove you have ownership of the domain and the key - is that what you are talking about here?). So you can use the same cert for both Apache and NodeJs.

A better solution would be to use the standard ports and ProxyPass the node service from Apache (often as plain http but can also be https if you want): Apache and Node.js on the Same Server. That way you'd have Apache listening on port 80 (redirecting to port 443) and port 443 and node service only available via Apache.

Community
  • 1
  • 1
Barry Pollard
  • 40,655
  • 7
  • 76
  • 92
  • I couldn't get the ProxyPass solution to work. I'm working on a configuration panel, and I have a form that needs to post to NodeJS for something to happen. The only issue is that I can't get LetsEncrypt to cover the other ports (which are not 80 and 443). How do I force LE to put SSL on a certain port? – Adam S. Apr 17 '16 at 01:31
  • 1
    Why couldn't you get ProxyPass to work? And what do you mean by "How do I force LE to put SSL on a certain port"? A certificate has nothing to do with a port so not sure why you think LE needs to do anything here - unless as I say you are talking about for LE to load the challenge file to confirm ownership. – Barry Pollard Apr 17 '16 at 03:53
0

you can use SSL on a different port just make sure you allow it on your firewall

sudo ufw allow [port number]