server
Differences
This shows you the differences between two versions of the page.
| server [2026-01-17 11:37] – created mathog | server [2026-01-17 11:40] (current) – mathog | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== HTTPS ====== | ||
| + | ===== Generate a Self-Signed Certificate ===== | ||
| + | |||
| + | Use the openssl command to create a self-signed SSL certificate and private key. Run the following command, replacing yourdomain.com with your server' | ||
| + | < | ||
| + | sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout / | ||
| + | </ | ||
| + | |||
| + | This generates a certificate valid for 365 days and stores the key and certificate in standard Apache SSL directories. | ||
| + | |||
| + | ===== Configure Apache to Use the Certificate ===== | ||
| + | |||
| + | Enable the SSL module and update the SSL virtual host configuration: | ||
| + | |||
| + | < | ||
| + | sudo a2enmod ssl | ||
| + | sudo nano / | ||
| + | </ | ||
| + | |||
| + | Inside the < | ||
| + | |||
| + | < | ||
| + | SSLCertificateFile / | ||
| + | SSLCertificateKeyFile / | ||
| + | </ | ||
| + | |||
| + | Save and exit, then restart Apache: | ||
| + | |||
| + | < | ||
| + | sudo systemctl restart apache2 | ||
| + | </ | ||
| + | |||
| + | Test and Handle Browser Warnings | ||
| + | Access your site via '' | ||
