Setting up Apache Reverse Proxy over SSL
Apache Installation
1. Standalone Installation in Fedora-based systems
This is meant for Operating Systems such as RHEL and CentOS.
Use the following commands:
sudo yum install httpd mod-ssl
sudo yum install mod_proxy_html
Disabling SELinux
CentOS 7 and Red Hat Enterprise Linux 7 (RHEL 7) come with SELinux pre-installed. This must be disabled because SELinux blocks Apache from loading content outside default directories.
Alternatively, a custom policy can be added to SELinux, which is beyond the scope of this document.
Steps to disable SELinux follow:
Temporary (single session)
sudo setenforce 0
sudo sestatus
Check: Current mode: permissive
Permanent (needs reboot to work)
sudo vi /etc/selinux/config
- Change '
SELINUX=enforcing
' to 'SELINUX=disabled
'. - Save the file.
2. Xampp/Lampp installation
This is meant for Operating Systems such as Windows and Linux.
Run the '.run' installer from Xampp official website.
Firewall configurations will be set by default and the required mods will be enabled during installation.
Managing the Apache server for Lampp
Follow any one of the two options below:
- Use Lampp GUI
Go to ampp install dir and use the following commands accordingly:
To Start:
CODEsudo ./<Install Dir>/lampp startapache
To Stop:
CODEsudo ./<Install Dir>/lampp stopapache
To Restart:
CODEsudo ./<Install Dir>/lampp restartapache
List status of all Lampp servers/services:
CODEsudo ./<Install Dir>/lampp status
- Use Lampp GUI
Setting up the Virtual Host
1. Apache reverse proxy with SSL
For SSL-based Apache Reverse Proxy, put the template in the appropriate directory based on the installation, rename it and modify it as required.
Click template-ssl.conf to download the sample file to be used in the following sections.
Standalone Fedora
Target Path: /etc/httpd/conf.d/ssl.conf
Xampp
Target Path: /opt/lamp/etc/extra/httpd-ssl.conf
2. Apache reverse proxy with Mutual TLS
For SSL-based Apache Reverse Proxy, put the template in the appropriate directory based on the installation, rename it and modify it as required:
Click template-mtls.conf to download the sample file to be used in the following sections.
Standalone Fedora
Target Path: /etc/httpd/conf.d/ssl.conf
Xampp
Target Path:/opt/lamp/etc/extra/httpd-ssl.conf
Customizing the template Proxy Configuration
A passphrase file must be provided with executable permissions; a template of this file is provided for the passphrase 'fiorano'. Change it accordingly for the required use case. Every proxy server configuration template file provided has this setting enabled by default.
When the certificate is encrypted
Do the following in the proxy configuration:
Set the
SSLPassPhraseDialog exec:<Path to passphrase dialog file>/passphrase-file.conf
click passphrase-file.conf for the sample file.
Run in the terminal
CODEsudo chmod 777 passphrase-file.conf
When the certificate is not encrypted
Comment:
CODESSLPassPhraseDialog exec:<Path to passphrase dialog file>/passphrase-file.conf
Uncomment:
CODESSLPassPhraseDialog builtin