In this article we explain how to install the SSL certificate and/or the certification authority (CA) certificate on our Apache 2.4 web server
Once we have purchased the SSL certificate and the corresponding validation process has been carried out by the Certification Authority (CA) that issues it, it sends us the already validated SSL certificate. It is usually sent in the form of attached files, or also as text that we must separate and place in the appropriate .crt files following our provider's instructions.
We enable the SSL Module
Redhat and derivatives:
yum install mod_ssl.x86_64Debian and derivatives:
apt install openssl ssl-cert
a2enmod sslSuse
a2enmod ssl
«ssl» already presentWe access /etc/sysconfig/apache2 and we modify the following line:
APACHE_SERVER_FLAGS=»SSL»We restart the service
service apache2 reloadWe edit the file /etc/apache2/listen.conf and it should look like this:
<IfDefine SSL>
<IfDefine !NOSSL>
<IfModule mod_ssl.c>
Listen 443
NameVirtualHost *:443
</IfModule>
</IfDefine>
</IfDefine>We check that we have correctly activated the module on our GNU/Linux server
httpd -M
ssl_module (shared)We create the directory where the certificate will be housed:
Redhat and derivatives:
mkdir /etc/httpd/certs/Suse, Debian and derivatives:
mkdir /etc/apache2/certs/We create the virtualhost with the SSL configuration
When configuring you have to take into account where the settings are located depending on the operating system:
Redhat and Derivatives:
/etc/httpd/conf.d/Suse, Debian and derivatives:
/etc/apache2/conf.d/VirtualHost:
<VirtualHost *:80>
ServerAdmin wadmin@red-orbita.com
DocumentRoot «/var/www/html/»
ServerName red-orbita.com
ServerAlias red-orbita.com
ErrorLog «/var/log/httpd/red-orbita.com-error_log»
CustomLog «/var/log/httpd/red-orbita.com-access_log» combined
#Redireccionamos al puerto https
Redirect permanent / https://tpldes.madrilena.es/
<Directory «/var/www/html/»>
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost _default_:443>
ServerAdmin wadmin@red-orbita.com
DocumentRoot «/var/www/html/»
ServerName red-orbita.com
ServerAlias red-orbita.com
ErrorLog «/var/log/httpd/red-orbita.com -ssl-error_log»
CustomLog «/var/log/httpd/red-orbita.com -ssl-access_log» combined
<Directory «/var/www/html/»>
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
SSLCompression Off
SSLEngine on
SSLProxyEngine on
SSLProxyCheckPeerName off
SSLProxyCheckPeerCN off
SSLProxyProtocol +TLSv1
SSLCertificateFile /etc/httpd/certs/red-orbita.com.crt
SSLCertificateKeyFile /etc/httpd/certs/red-orbita.com.key
</VirtualHost>All the best
:wq!
Comments