https://www.godaddy.com/garage/how-to-install-an-ssl-certificate-on-ubuntu-for-nginx/
How to secure the service with an SSL certificate
To get started, you’ll first need to purchase or acquire the SSL certificate. If needed, here are additional details on how to request an SSL certificate and verify it.
If you have purchased a CA-approved SSL certificate, delivery might take from hours for a DV to weeks for an EV. The CA will inform you when the certificate is ready for download. Here’s how to retrieve it in seven steps:
- Log into Account Manager.
- Click SSL Certificates.
- Pick the certificate you want to use and click Manage.
- Next to the certificate you want to use, in the Actions column, click View Status.
- Click Download.
- Select the server type, and then click Download Zip File.
- Safely store the downloaded file for the future.
How to install an SSL certificate for the Nginx server on Ubuntu
Installing an SSL digital certificate for Nginx won’t bust the brain.
1. Log into the server using SSH.
2. Check the OpenSSL client software.
Make sure the OpenSSL client software needed for a secure website is in place with:
$ sudo apt-get mod_ssl openssl
This will either install OpenSSL or inform you that it’s already present.
3. Make a directory to store the server key and certificate.
$ sudo mkdir mkdir /etc/nginx/ssl
4. Copy the SSL certificate file and server key.
$ sudo cp server.crt /etc/nginx/ssl $ sudo cp server.key /etc/nginx/ssl
5. Edit the ssl.conf or httpd.conf file.
Here’s an example using the vi text processor:
$ sudo vi //etc/nginx/sites-available/default/your_very_own_domain.com
Once open, the file can be edited so that it points to the correct files in the Web server. It will look something like:
server { listen 80; listen 443 ssl; ssl on; ssl_certificate /etc/ssl/your_domain_name.pem; ssl_certificate_key /etc/ssl/your_domain_name.key; server_name your_very_own_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_very_own_domain.com/public/; index index.html; } }
6. Restart the Web server.
Use the following command to restart the Web server:
$ sudo /etc/init.d/nginx restart
The secured site should be available at https://www.your_very_own_domain.com.
Tidak ada komentar:
Posting Komentar