How to Relay HTTPS traffic to HTTP Endpoint using NGINX

Create a file in the site-available folder

vim /etc/nginx/sites-available/backendservice.conf

and past the following line in it

server {
    client_max_body_size 100M;
    server_name PUB_API;
    listen 3555 ssl;
    #listen 80;
    ssl_certificate /etc/letsencrypt/live/backendservice.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/backendservice.com/privkey.pem;

    location / {
        proxy_pass http://localhost:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_read_timeout 60;
        proxy_connect_timeout 60;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Note

This Configuration file will start listening on port 3555 (https) and start forwarding traffic to port 5000 (http)


create a Symlink to file

cd /etc/nginx/sites-enabled
unlink default
ln -s ../sites-available/backendservice.conf backendservice.conf
systemctl restart nginx

Enjoy 😉

How to compile and run a next application ?

Install nodejs Use  this  link for further reading curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash nvm inst...