DEV Community

Lance
Lance

Posted on

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
Enter fullscreen mode Exit fullscreen mode

Install SSL module.

sudo dnf install mod_ssl
Enter fullscreen mode Exit fullscreen mode

Install HTTP/2 module.

sudo dnf install mod_http2
Enter fullscreen mode Exit fullscreen mode

Enable modules in Apache configuration

Edit Apache configuration file.

sudo vi /etc/httpd/conf/httpd.conf
Enter fullscreen mode Exit fullscreen mode

Load modules.

LoadModule ssl_module modules/mod_ssl.so
LoadModule http2_module modules/mod_http2.so
Enter fullscreen mode Exit fullscreen mode

Configure virtual host for HTTPS

Create a new virtual host block for your domain:

<VirtualHost *:443>
    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
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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. 

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay