How do I transfer an SSL certificate from an Apache server to an NGINX server

10,338

You need to Copy the following files:

  1. SSL_Certificate.crt
  2. SSL_Certificate.key

from the APACHE SSL Configuration path To the NGINX Server Configuration Path.

Now open your Nginx virtual host file for the website you are securing. If you need your site to be accessible through both secure (https) and non-secure (http) connections, you will need a server module for each type of connection. Make a copy of the existing non-secure server module and paste it below the original. Then add the lines in bold below:

server {

listen   443;

ssl    on;
ssl_certificate    /etc/ssl/your_domain_name.crt; (or .pem)
ssl_certificate_key    /etc/ssl/your_domain_name.key;

server_name your.domain.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
    root   /home/www/public_html/your.domain.com/public/;
    index  index.html;
}

}

Adjust the file names to match your certificate files:

Now Restart Nginx.

Run the following command to restart Nginx:

sudo /etc/init.d/nginx restart
Share:
10,338

Related videos on Youtube

Lucas Scholten
Author by

Lucas Scholten

Updated on September 18, 2022

Comments

  • Lucas Scholten
    Lucas Scholten almost 2 years

    How do I transfer an SSL certificate from an Apache server to an NGINX server?

    Any help is much appreciated.

  • trainoasis
    trainoasis over 4 years
    and how do we find the relevant apache/nginx paths?