How to Enable SSL and Install Certificate: A Step-by-Step Guide

2023-06-21 04:32:19
This part is relatively simple, just use “command line prompt characters” to SSH to connect to the host, and execute some commands directly. Answer Y, and then… ●Enabling SSL is explained in two parts. First, if you have purchased an official certificate, you only need to upload the official certificate to the website. 2. There is no official certificate, but a temporary certificate needs to be installed first to test whether https can run. We will do the second type first, and the first type will be done following the official launch. Decide on a DNS domain name for testing, for example: testc.onweb.idv.tw (trust me, this is fake, just an example), and then add an A record to your domain, pointing to the IP of this host . Install the Certbot client to install and manage SSL. To be honest, I am not familiar with Certbot. Anyway, our official website will buy official certificates, and this is just a temporary use. # Install the Certbot client sudo apt-get install python3-certbot-apache -y Follow the example, select OK to apply and set the certificate of your domain name, pay attention! The domain name should be changed to yours! # Please pay attention to use The domain name sudo certbot –apache -d testc.onweb.idv.tw This process will be a little more complicated, you need to enter your EMail (true, you can receive the letter.), agree (Y), and receive the notification ( Y)… Then it’s set! Then use https to connect to your website and have a look! For example, I can see the lock logo on my test website, and then look at the certificate information! Pay attention to the expiration of the certificate Day! Sorry, I’m not sure, what will happen following the expiration date, and how to renew it? Friends in need~ Check it out on the Internet. Because, the website I am currently building is going to be officially launched in the end. We have to buy an official SSL certificate. By the way, let me explain how to go online with the official certificate of the website. (The method described below may be just one of many ways. I have used it twice and it can work normally.) First find out the location of Apache’s Config File, which is usually located in /etc/apache2/apache2.conf The certificate I have purchased, to Get the files used on apache, as shown in the figure below: Create a folder on the host, and put it directly in the ssl folder under the directory of the account! For example: /home/jasonadmin/ssl Upload these three files. Download apache2.conf by the way and modify it (located in /etc/apache2/ of the host), remember to back it up before modifying. The modified content is as follows: Find the VirtualHost location and add the following content according to the following example (there should be no default), and the following certificate names need to be modified accordingly. This is where the account name jasonadmin and the official website name 123.onweb.idv.tw (also the credential file name) are.

ServerName 123.onweb.idv.tw
DocumentRoot /var/www/html
SSLEngine on
SSLCACertificateFile /home/jasonadmin/ssl/SO3-Bundle.crt
SSLCertificateFile /home/jasonadmin/ssl/123.onweb.idv.tw.crt
SSLCertificateKeyFile /home/jasonadmin/ssl/123.onweb.idv.tw.key

After the modification is completed, save the file, upload it to the host, and then when it is officially launched, the replacement action will begin! Please pay attention to modifying the following instructions to your real location. # Suspend apache sudo systemctl stop apache2 # Backup the apache2.conf file before copying sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2_20230621.conf # Copy sudo cp /home/jasonadmin/ssl/apache2.conf /etc /apache2/apache2.conf Syntax check for apache2.conf. # apache2.conf Check syntax sudo apache2ctl configtest Syntax OK similar to the following screen will appear Next, restart apache2 to complete. This article is a record of my experience, thank you for watching, because I am a Linux novice, in order to transfer the company’s host to the Azure cloud, I crossed the river while feeling the stones, and installed regarding five hosts before and following. Recorded and also shared with you.

1687324499
#Set #Ubuntu #host #Azure #install #apache #PHP #enable #SSL #Part

Share:

Facebook
Twitter
Pinterest
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.