Report this

What is the reason for this report?

https is not working on different port on Nginx server

Posted on December 27, 2022

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.



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!

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.

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.

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

Is working well without HTTPS???

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.