Build httpd with HTTP/2 support
Apache Http To Https Redirection
mod_http2
uses the library of nghttp2 as its implementation base. In order to build mod_http2
you need at least version 1.2.1 of libnghttp2
installed on your system.
Apache Http To Https Redirect
If you have the UFW firewall enabled, as recommended by the prerequisite guides, you’ll need to adjust the settings to allow HTTPS traffic. Upon installation, Apache registers a few different UFW application profiles. We can leverage the Apache Full profile to allow both HTTP and HTTPS traffic on your server.
Creating an Apache Configuration Snippet with Strong Encryption Settings. First, we will create an Apache configuration snippet to define some SSL settings. This will set Apache up with a strong SSL cipher suite and enable some advanced features that will help keep our server secure. Step 1: Install / Configure Apache2 HTTPS. To configure Apache2 to redirect all traffic to HTTPS, you must configure and enable its SSL modules. The post below shows you how to install and configure Apache2 to communicate over HTTPS however, both HTTP and HTTPS are enabled the method below will show you how to redirect all traffic to the. To apply this certificate in your website URL, you need to redirect HTTP to HTTPS to ensure optimum safety, accessibility and compliance. Editing the.htaccess file for redirection First of all, redirection from HTTP to HTTPS involves editing the.htaccess file.
When you ./configure
you Apache httpd source tree, you need to give it '--enable-http2
' as additional argument to trigger the build of the module. Should your libnghttp2
reside in an unusual place (whatever that is on your operating system), you may announce its location with '--with-nghttp2=<path>
' to configure
.
While that should do the trick for most, they are people who might prefer a statically linked nghttp2
in this module. For those, the option --enable-nghttp2-staticlib-deps
exists. It works quite similar to how one statically links openssl to mod_ssl
.
Speaking of SSL, you need to be aware that most browsers will speak HTTP/2 only on https:
URLs, so you need a server with SSL support. But not only that, you will need a SSL library that supports the ALPN
extension. If OpenSSL is the library you use, you need at least version 1.0.2.
NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:
The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.
TIP: To quickly get started with HTTPS and SSL, follow these instructions to auto-configure a Let’s Encrypt SSL certificate.
Approach A: Bitnami installations using system packages
Follow these steps:
Add the following lines in the default Apache virtual host configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami.conf, inside the default VirtualHost directive, so that it looks like this:
To redirect all HTTP requests to a particular domain, specify the domain name as a static value in the rewrite rule instead of using the SERVER_NAME variable. Here’s an example of redirecting all HTTP requests to https://example.com:
Add the same lines in the file at /opt/bitnami/apache2/conf/bitnami/bitnami-ssl.conf.
Clean up mac storage other. Add the same lines in any file ending with the prefix -vhost.conf in the /opt/bitnami/apache2/conf/vhosts/ directory.
Approach B: Self-contained Bitnami installations
Follow these steps:
Add the following lines in the default Apache virtual host configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami.conf, inside the default VirtualHost directive, so that it looks like this:
To redirect all HTTP requests to a particular domain, specify the domain name as a static value in the rewrite rule instead of using the SERVER_NAME variable. Here’s an example of redirecting all HTTP requests to https://example.com:
After modifying the Apache configuration files, open port 443 in the server firewall. Refer to the FAQ for more information.
Restart Apache to apply the changes.