Apache httpd-2.4 - Secured Configuration on Fedora

To configure a secured Apache HTTP/2.4 on Fedora, you need to install the Apache web server, enable the necessary modules like mod_ssl for SSL encryption and mod_http2 for HTTP/2 support, and then modify your Apache configuration file to specify the protocols and secure your virtual hosts with SSL certificates; essentially, enabling both HTTP/2 and HTTPS functionality on your Apache server.  Install Apache and necessary modules Install Apache. sudo dnf install httpd Install SSL module. sudo dnf install mod_ssl Install HTTP/2 module. sudo dnf install mod_http2 Enable modules in Apache configuration Edit Apache configuration file. sudo vi /etc/httpd/conf/httpd.conf Load modules. LoadModule ssl_module modules/mod_ssl.so LoadModule http2_module modules/mod_http2.so Configure virtual host for HTTPS Create a new virtual host block for your domain: ServerName yourdomain.com DocumentRoot /var/www/html/yourdomain SSLCertificateFile /path/to/your/certificate.crt SSLCertificateKeyFile /path/to/your/private.key # Enable HTTP/2 Protocols h2 http/1.1 Replace yourdomain.com with your actual domain name. Replace /path/to/your/certificate.crt and /path/to/your/private.key with the paths to your SSL certificate and private key respectively. Restart Apache sudo systemctl restart httpd Important Considerations: Obtain SSL certificates - You will need to obtain a valid SSL certificate from a trusted certificate authority (CA) to secure your website with HTTPS.  Firewall configuration - Ensure your firewall is configured to allow incoming connections on port 443 (HTTPS).  HTTP to HTTPS redirection - Consider using a rewrite rule to automatically redirect all HTTP requests to the HTTPS version of your website. 

Feb 20, 2025 - 09:28
 0
Apache httpd-2.4 - Secured Configuration on Fedora

To configure a secured Apache HTTP/2.4 on Fedora, you need to install the Apache web server, enable the necessary modules like mod_ssl for SSL encryption and mod_http2 for HTTP/2 support, and then modify your Apache configuration file to specify the protocols and secure your virtual hosts with SSL certificates; essentially, enabling both HTTP/2 and HTTPS functionality on your Apache server. 

Install Apache and necessary modules

Install Apache.

sudo dnf install httpd

Install SSL module.

sudo dnf install mod_ssl

Install HTTP/2 module.

sudo dnf install mod_http2

Enable modules in Apache configuration

Edit Apache configuration file.

sudo vi /etc/httpd/conf/httpd.conf

Load modules.

LoadModule ssl_module modules/mod_ssl.so
LoadModule http2_module modules/mod_http2.so

Configure virtual host for HTTPS

Create a new virtual host block for your domain:


    ServerName yourdomain.com
    DocumentRoot /var/www/html/yourdomain

    SSLCertificateFile /path/to/your/certificate.crt
    SSLCertificateKeyFile /path/to/your/private.key

    # Enable HTTP/2
    Protocols h2 http/1.1

Replace yourdomain.com with your actual domain name.

Replace /path/to/your/certificate.crt and /path/to/your/private.key with the paths to your SSL certificate and private key respectively.

Restart Apache

sudo systemctl restart httpd

Important Considerations:

  1. Obtain SSL certificates - You will need to obtain a valid SSL certificate from a trusted certificate authority (CA) to secure your website with HTTPS. 

  2. Firewall configuration - Ensure your firewall is configured to allow incoming connections on port 443 (HTTPS). 

  3. HTTP to HTTPS redirection - Consider using a rewrite rule to automatically redirect all HTTP requests to the HTTPS version of your website.