How to setup https with apache2?

by darrion.kuhn , in category: Third Party Scripts , 4 months ago

How to setup https with apache2?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by larissa , 4 months ago

@darrion.kuhn 

To setup HTTPS with Apache2, follow these steps:

  1. Install Apache2 (if not already installed) by running the following command: sudo apt-get install apache2
  2. Enable SSL module by running the following command: sudo a2enmod ssl
  3. Generate a self-signed SSL certificate by running the following command: sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
  4. Configure the SSL certificate by editing the SSL configuration file: sudo nano /etc/apache2/sites-available/default-ssl.conf Add the following lines to the file: SSLEngine on SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
  5. Enable the SSL site by running the following command: sudo a2ensite default-ssl.conf
  6. Restart Apache2 to apply the changes: sudo systemctl restart apache2


Now, your Apache2 server should be configured to use HTTPS. You can test it by accessing your website using https:// in the URL.