skip to Main Content

I am hosting my web application on NGINX server.Till now it worked fine, but I don’t know why I am getting the errors present in the image below.enter image description here

I don’t know why these errors occur, but as a trial and error method I thought my ssl certificated got expired so I updated it. Same errors got repeated.And also checked my conf.d file, not sure that everything is good.
Here is my conf file

worker_processes 1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    send_timeout 100s;
    keepalive_timeout  95;
    #ssl_session_cache   shared:SSL:10m;
    #ssl_session_timeout 10m;
    client_body_in_file_only clean;
    client_body_buffer_size 32K;
    client_max_body_size 300M;

    server {
        listen              80;
        listen              443 ssl;
        server_name         sample.com;
        ssl_certificate     ..sslmbxxxx.crt;
        ssl_certificate_key ..sslmbkey.pem;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    
    
    location / {
            proxy_http_version 1.1;
        client_max_body_size 300M;
        proxy_read_timeout 300s;
            proxy_connect_timeout 95s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $http_referer;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header content-type "application/json";
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header REMOTE_ADDR $remote_addr;
            proxy_set_header Access-Control-Allow-Origin *;
        proxy_set_header Connection 'upgrade';
            proxy_pass http://127.0.0.1:xxxx;   
        }
    location /api {
            proxy_http_version 1.1;
        client_max_body_size 300M;
        proxy_read_timeout 300s;
            proxy_connect_timeout 95s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $http_referer;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header content-type "application/json";
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header REMOTE_ADDR $remote_addr;
            proxy_set_header Access-Control-Allow-Origin *;
        proxy_set_header Connection 'upgrade';
            proxy_pass http://127.0.0.1:xxxx;   
        }
    
    error_page  405     =200 $uri;
     # error_page   500 502 503 504  /50x.html;
        #location = /50x.html {
            #root   html;
        #}
    }
    
}

enter code here

And there are no CORS restrictions.Any suggestions and reference docs would be great help.
And I don’t know that this question servers my request or not.
Thanks in Advance.

2

Answers


  1. Chosen as BEST ANSWER

    So when I am doing some research on how to solve this issue, I found an answer that I have to remove passphrase in SSL certificate.I didn't get it. So what I have done is, I updated SSL certificate then I run my application. But not succeeded. So I thought nginx should be restarted after updating SSL certificate. Shockingly after restarting nginx, it worked fine.


  2. You can specify passphrase in text file, and connect it via ssl_password_file directive. Something like this:

    listen 3001 ssl;
    
    ssl_certificate         cert.pem;
    ssl_certificate_key     key.pem;
    ssl_password_file       pass.txt
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search