Skip to content

Instantly share code, notes, and snippets.

@jaehoo
Last active June 2, 2018 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaehoo/4668021 to your computer and use it in GitHub Desktop.
Save jaehoo/4668021 to your computer and use it in GitHub Desktop.
Apache Reverse proxy configuration: - proxied sites with by https - proxied web sites with java servers by ajp protocol - proxyed cookies ** You need installed a SSL cert to access https resources
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
User apache
Group apache
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/var/www"
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/var/www/html">
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# Note: If "Indexes" is specified, the server will automatically
# generate directory listings for any URL request which maps to
# a directory that doesn't include any of the DirectoryIndex
# files, such as index.html.
#
# Options FollowSymLinks
#Options All
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
# AllowOverride None
#
# Controls who can get stuff from this server.
#
# Order allow,deny
# Allow from all
#</Directory>
<IFModule mod_proxy.c>
<VirtualHost *:80>
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
AllowOverride All
Allow from All
</Directory>
ServerAdmin webmaster@orbitalzero.com
ServerName www.mydomain.com
ServerAlias tomcat
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
</IFModule>
<IFModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.mydomain.com
#
# https proxy
#
ProxyPass /secure/ https://secure.mydomain.com:8443/myWebApp/
ProxyPassReverse /secure/ https://secure.mydomain.com:8443/myWebApp/
ProxyPassReverseCookiePath /myWebApp /secure
#
# Portal Jboss
#
ProxyPass / ajp://local.tomcat.com:8009/myWebApp/
ProxyPassReverse / ajp://local.tomcat.com:8009/myWebApp/
ProxyRequests Off
ProxyPreserveHost On
<proxy >
Order deny,allow
Allow from all
</proxy>
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/apache2/certs/root.crt
SSLCertificateKeyFile /etc/apache2/certs/eph.pem
SSLCertificateChainFile /etc/apache2/certs/inter.crt
</VirtualHost>
</IFModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment