Reverse proxy http to https with Nginx Webserver on Windows

These are steps to change your http routes to https.

Step1. Go to this url and download the zip installer from here ( nginx: download ) and unzip it.

Step 2. Generate the certificate for your machine. Take reference from here.

djay21/Nginx-reverse-proxy (github.com)

Step 3. Copy your certsin your windows machine, if created from another machine and paste it on the nginx folder (root location).

Step 4. Update your ~/nginx/conf/nginx.conf file with this one. Replace localhost with your dns name and proxy_pass url with your local base url on which your application is working.

#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 443 ssl;
server_name localhost; #replace localhost with you dns name
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:8000;
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;
}
}
server {
listen 5002 ssl;
server_name localhost;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:5001;
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;
}
}
}

Step 5. Run your Nginx server, double click on nginx.exe.

And browse your application on https://domainname.com/pages