Fedora 40
Sponsored Link

Apache httpd : SSL/TLS Setting2024/05/14

Configure SSL/TLS setting to use secure encrypt HTTPS connection.
[2] Enable SSL/TLS settings.
[root@www ~]#
dnf -y install mod_ssl
[root@www ~]#
vi /etc/httpd/conf.d/ssl.conf
# line 59 : uncomment

DocumentRoot "/var/www/html"
# line 60 : uncomment and specify hostname

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

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

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

[root@www ~]#
systemctl restart httpd

[3] If you'd like to set HTTP connection to redirect to HTTPS (Always on SSL/TLS), Set RewriteRule to each Host settings.
For example, if you set Virtual Hostings like the link here, 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]

[root@www ~]#
systemctl reload httpd

[4] If Firewalld is running, allow HTTPS service. HTTPS uses 443/TCP.
[root@www ~]#
firewall-cmd --add-service=https

[root@www ~]#
firewall-cmd --runtime-to-permanent

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