Question

https is not working on different port on Nginx server

I’m using the Nginx server for my node js application deployment. my domain (http://tisbeta.com:9002/) Is working well without HTTPS on different ports like 9001 and 9002 but when I install the let’s encrypt SSL certificate the port stops working(https://tisbeta.com:9002 ).im try so many solutions but not working.


Submit an answer
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 29, 2022

Hi there,

What I could suggest here is to use Nginx as a reverse proxy as described here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-22-04

That way your application will be running locally on http://localhost:9002 and the Nginx proxy will be forwarding the traffic from HTTPS to that internal port, for example:

server {
...
    location / {
        proxy_pass http://localhost:9002;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
...
}

Let me know how it goes!

Best,

Bobby

KFSys
Site Moderator
Site Moderator badge
December 29, 2022

Hi @ankitlukhi,

Can you post here your Nginx conf for HTTPS? I would assume Let’s Encrypt installs the default config for 443 and does not take into account the reverse proxy you have configured.