Apache httpd : Configure SSL/TLS

[1]. Enable SSL/TLS settings

[root@www ~]# dnf -y install mod_ssl

[root@www ~]# vi /etc/httpd/conf.d/ssl.conf

# line 43: uncomment

DocumentRoot "/var/www/html"

# line 44: uncomment and specify hostname

ServerName www.srv.world:443

# line 85: change to the one got in [1]

SSLCertificateFile /etc/letsencrypt/live/www.srv.world/cert.pem

# line 93: change to the one got in [1]

SSLCertificateKeyFile /etc/letsencrypt/live/www.srv.world/privkey.pem

# line 102: change to the one got in [1]

SSLCertificateChainFile /etc/letsencrypt/live/www.srv.world/chain.pem

[root@www ~]# systemctl restart httpd

[2]. If you'd like to set HTTP connection to redirect to HTTPS (Always on SSL/TLS), Set RewriteRule to each Host settings.

Add RewriteRule like follows. Or It's possible to set RewriteRule in [.htaccess] not in [httpd.conf]. 

[root@www ~]# vi /etc/httpd/conf.d/vhost.conf

<VirtualHost *:80>

    DocumentRoot /var/www/html

    ServerName www.srv.world

    RewriteEngine On

    RewriteCond %{HTTPS} off

    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</VirtualHost>

[root@www ~]# systemctl restart httpd

[3]. If Firewalld is running, allow HTTPS service. HTTPS uses 443/TCP.

[root@www ~]# firewall-cmd --add-service=https --permanent

 success

[root@www ~]# firewall-cmd --reload

success

[4]. Verify to access to the test page from any client computer with Web browser via HTTPS.






Comments

Popular posts from this blog

Java : Variables Declaring

Install DNF in RHEL/CentOS 7

SQL Self JOIN