0

Im trying to install SSl on my nginx server. Everything works fine however Im receiving error while setting up my CA bundle file. I dont know how to place my CA file in nginx. For apache we place the cert files including CA file like this

SSLEngine on

 SSLCertificateFile      /etc/apache2/ssl/example_com.crt
 SSLCertificateKeyFile /etc/apache2/ssl/example.com.key
 SSLCertificateChainFile /etc/apache2/ssl/example_com.ca-bundle 

How would we place it in Nginx. This is my config file for my nginx

server {
        root /var/www/html/example/dist;
        index index.html index.htm index.nginx-debian.html;

  server_name example.com;
server_name www.example.com;

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

  location /example/ {
      proxy_pass http://localhost:3013/;
      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;
  }

   ssl_certificate /etc/nginx/ssl/example_com.crt;
   # ssl_certificate /etc/nginx/ssl/CAbundle.crt;
    ssl_certificate_key /etc/nginx/ssl/example.key;
   # ssl_trusted_certificate /etc/nginx/ssl/CAbundle.crt;
    ssl_dhparam /etc/nginx/ssl/dhparam-2048.pem;
    listen [::]:443 ssl;
    listen 443 ssl;


}

server {
    if ($host = www.example.com) {
        return 301 https://www.$host$request_uri;
    } 


    if ($host = example.com) {
        return 301 https://www.$host$request_uri;
    } }
2
  • See this document, but the server certificate and CA bundle need to be concatenated into a single file. Commented Aug 7, 2019 at 8:43
  • @RichardSmith Thank you ,it worked I missed this step $ cat www.example.com.crt bundle.crt > www.example.com.chained.crt Commented Aug 7, 2019 at 9:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.