Follow the step by step instructions to install an SSL certificate on your NGINX Server in a few minutes.
NGINX is an open source HTTP server works also as an IMAP/POP3 proxy server. High performance, constancy, ample features, simple constellation, and low resource utilization are some useful elements of NGINX server. The server also has a scalable and unsynchronized architecture that uses a predictable and small amount of load memory.
- Open the email attachment of “your_domain.pem” file received from your SSL provider. This PEM file contains the intermediate and primary certificate.
- After downloading both certificate files, copy the files to the server directory along with “.key file“(created while CSR generation process).
- Combine two files (primary certificate and intermediate certificate) into a single PEM file with the below command:
Syntax: cat domain_name.crt domain_name.ca-bundle > ssl-bundle.crt
- Once you combine all the files, you need to configure them into NGINX virtual host.
Install SSL Certificate in NGINX Virtual Host
Open NGINX virtual host and copy “ssl-bundle.crt” file into the server location. For users of ubuntu server, the location path will be /etc/SSL/certs/ and for window users, the path will be /user/local/SSL/certs.
Now, search for domain configuration file and modify it. You can find the domain configuration file in either /etc/nginx/sites-available/ or /user/local/nginx/sites-available/.
Now keep SSL option to “ON”
ssl on;
Set SSL port to “Listen” and it should be 443
listen 443;
Place the new “ssl-bundle.crt” file to “ssl_certificate”
SSL certificate /etc/ssl/certs/ssl-bundle.crt;
Set the private key to ‘ssl_certificate_key’
ssl_certificate_key /etc/ssl/private/mysite.key;
After configuration, the NGINX virtual file will look like below:
server { listen 443; server_name domainname.com; ssl on; ssl_certificate /etc/ssl/certs/ssl-bundle.crt; ssl_certificate_key /etc/ssl/private/domainname.key; ssl_prefer_server_ciphers on; }
Restart NGINX Server using command:
sudo /etc/init.d/nginx restart
Your SSL certificate is installed on the NGINX HTTP server.
Once an SSL certificate installed on your NGINX Server, check your website using our SSL Installation Checker to diagnose SSL errors.