apache:activate_ssl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
apache:activate_ssl [2020/07/17 14:26] – old revision restored (2016/10/11 00:10) 198.27.66.59 | apache:activate_ssl [2022/06/14 08:16] (current) – [Configure the Virtual Host] peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Apache - Activate SSL ====== | ====== Apache - Activate SSL ====== | ||
+ | |||
+ | ===== Create folder for ssl certificate and key ===== | ||
+ | |||
+ | sudo mkdir / | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Get a certificate ===== | ||
+ | |||
+ | Obtain one from a recognized certificate authority, or alternatively create your own. | ||
+ | |||
+ | Create .key file and .crt file and after that load both apache2... | ||
+ | |||
+ | <code bash> | ||
+ | sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout / | ||
+ | </ | ||
+ | |||
+ | <WRAP notice> | ||
+ | **NOTE**: | ||
+ | |||
+ | Be sure to keep the intermediate files (.key and .csr) that you create in this step. | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Activate SSL ===== | ||
Issue the following command: | Issue the following command: | ||
Line 7: | Line 36: | ||
</ | </ | ||
- | **NOTE: | + | ---- |
- | Edit **/ | + | ===== Listen on Port 443 ===== |
+ | |||
+ | SSL sites run under port 443 so enable **Listen 443** in **/ | ||
+ | |||
+ | <code bash> | ||
+ | vi / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Create a SSL page under sites-available ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo file / | ||
+ | </ | ||
+ | |||
+ | and populate the file as: | ||
+ | |||
+ | <file bash site.conf> | ||
+ | < | ||
+ | SSLEngine On | ||
+ | SSLCertificateFile / | ||
+ | SSLCertificateKeyFile / | ||
+ | DocumentRoot / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Configure the Virtual Host ===== | ||
+ | |||
+ | Edit **/ | ||
<file bash / | <file bash / | ||
NameVirtualHost [your IP address]: | NameVirtualHost [your IP address]: | ||
- | < VirtualHost [your IP address]: | + | < |
- | | + | ServerSignature On |
- | | + | SSLCertificateFile |
- | | + | SSLCertificateKeyFile / |
- | | + | SSLCertificateChainFile / |
- | SSLEngine On | + | SSLEngine On |
- | </ | + | </ |
</ | </ | ||
+ | <WRAP info> | ||
**NOTE**: You can also put the line **NameVirtualHost [your IP address]: | **NOTE**: You can also put the line **NameVirtualHost [your IP address]: | ||
+ | </ | ||
Now you can set up the site you want to run using SSL as you normally would. For example, you might have a file called ' | Now you can set up the site you want to run using SSL as you normally would. For example, you might have a file called ' | ||
Line 47: | Line 113: | ||
+ | Restart apache, and your site should work | ||
- | + | ---- | |
- | + | ||
- | 8. Restart apache, and your site should work | + | |
===== References ===== | ===== References ===== | ||
Line 57: | Line 122: | ||
* https:// | * https:// | ||
* http:// | * http:// | ||
+ | |||
apache/activate_ssl.1594995985.txt.gz · Last modified: 2020/07/17 14:26 by 198.27.66.59