Trying the configure SSL on Apache2 on Ubuntu server installed Apache
sudo apt install apache2
Opened ufw firewall
sudo ufw allow 'Apache'
ufw allow https
Installed SSL files in /root/cert
chmod 400 /root/cert/*
chmod 500 /root/cert/
In /etc/apache2/sites-available found two conf files: domainname.conf and default-ssl.conf.wordpress.conf Did not know which one to modify, so modified domainname.conf by adding following lines
<VirtualHost *:80>
ServerName www.domainname.com
ServerAdmin info@domainname.com
DocumentRoot /var/www/domainname
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName www.domainname.com
ServerAdmin info@domainname.com
DocumentRoot /var/www/domainname
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined # SSL
SSLEngine on
SSLCertificateFile /root/cert/domain.crt
SSLCertificateKeyFile /root/cert/domain.key
SSLCertificateChainFile /root/cert/ca_bundle.crt
</VirtualHost>
wordpress.conf has following entries:
<VirtualHost *:80>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
I check if SSL is running
netstat -ntlp | grep 443
tcp6 0 0 :::443 :::* LISTEN 961/apache2
when I perform http://localhost the website comes up. However when I perform https://localhost then it gives error ERR_SSL_PROTOCOL_ERROR. The website is wordpress based and there is a directory /srv/www/wordpress/ and there are several php files. This was created by another person and I don’t know if something needs to be edited in there for SSL.
Can someone tell me how to fix it?