reactjsnginxhttpsconfiguration

Nginx configuration issue with https on windows


I am trying to deploy my react app to nginx server. Http configuration is working fine, but https is not working. Here is my configuration file.

events {
    worker_connections  1024;
}  

http {
    server {
      listen 80;
      server_name example.com;
      root D:\\path-to-build\\build;
      index index.html;
     

      location / {
        try_files $uri /index.html =404;
      }
      }

    server {
        listen              443 ssl;
        server_name         example.com;
        keepalive_timeout   70;

        ssl_certificate     C:\\Certbot\\live\\domain\\fullchain.pem;
        ssl_certificate_key C:\\Certbot\\live\\domain\\privkey.pem;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         HIGH:!aNULL:!MD5;
        #...
        access_log D:\\path-to-log\\access.log;
        error_log D:\\path-to-log\\error.log;
        root D:\\path-to-build\\build;
        index index.html;
        location / {
          try_files $uri /index.html =404;
         }
    }
}

Solution

  • Configuration is correct only, but in my server machine 443 post is not open for outside. That's the reason I am getting connection timed out.