Oracle Linux/HTTP Reverse Proxy
From r00tedvw.com wiki
(Difference between revisions)
(→Conf) |
|||
Line 29: | Line 29: | ||
<nowiki>~$ sudo service httpd restart</nowiki> | <nowiki>~$ sudo service httpd restart</nowiki> | ||
==Conf== | ==Conf== | ||
− | Next is to configure the Conf file for the reverse proxy | + | Next is to configure the Conf file for the reverse proxy. This will include a rewrite rule for all HTTP traffic to be redirected to HTTPS. |
<nowiki>$~ sudo vim /etc/httpd/conf.d/website.conf | <nowiki>$~ sudo vim /etc/httpd/conf.d/website.conf | ||
# HTTP | # HTTP |
Revision as of 22:52, 4 February 2018
Contents |
Overview
This was done on a CentOS 6.9 x64 system.
Install Packages
~$ sudo yum update -y ~$ sudo yum install httpd openssh-server -y
Configure SSH
Configure HTTPD
Modules
Start by checking what modules are installed.
~$ sudo httpd -M Loaded Modules: core_module (static) mpm_prefork_module (static) http_module (static) so_module (static)....
Make sure that you see the following:
rewrite_module (shared) proxy_module (shared) proxy_http_module (shared)
If they are not listed, you can enable them by uncommenting or adding them to the httpd.conf
file.
~$sudo vim /etc/httpd/conf/httpd.conf LoadModule rewrite_module modules/mod_rewrite.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so
Restart httpd for any changes to be implemented
~$ sudo service httpd restart
Conf
Next is to configure the Conf file for the reverse proxy. This will include a rewrite rule for all HTTP traffic to be redirected to HTTPS.
$~ sudo vim /etc/httpd/conf.d/website.conf # HTTP <VirtualHost *:80> ServerName website.com #Logging LogLevel warn ErrorLog /var/log/httpd/website.com-error_log CustomLog /var/log/httpd/website.com-access_log combined #Redirect any HTTP request to HTTPS RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] </VirtualHost> # HTTPS <VirtualHost *:443> ServerName website.com #Logging ErrorLog /var/log/httpd/website.com-error_log CustomLog /var/log/httpd/website.com-access_log combined #Reverse Proxy Configuration ProxyPreserveHost On ProxyPass / https://redirected.site.com:8081/ ProxyPassReverse / https://redirected.site.com:8081/ #SSL #SSLEngine On #SSLCertificateFile #SSLCertificateKeyFile #SSLCertificateChainFile </VirtualHost>