Apache Reverse Proxy - q1dm4/readallaboutit GitHub Wiki
A linux version is here, all credit to the RocketMap team for the linked instructions. Apache Reverse Proxy Linux Setup
The following explains how to setup an Apache Reverse Proxy Server on a Windows machine running RocketMap. RocketMap runs on port 5000. The configuration has Apache accepting requests on port 8081 and then passing them on to RocketMap on port 5000 on the same server. Apache has password protected the RocketMap site with a single user named "rmuser".
Example is for a server with IP 192.168.1.10, port 8081, supermaprm.com and user rmuser. Insert your IP, port, domain and desired username.
-
Install Apache 2.4 on Windows using files from here: https://www.apachehaus.com/cgi-bin/download.plx If there are prerequisites needed, install them.
-
Install in the default directory C:\Apache24
- There are instructions on how to install Apache, make it a service, restart it etc. I wont go into that here. Make sure after install that you can start and stop Apache with out errors. You should be able to pull up the test page by putting http://192.168.1.10 in your browser.
-
Edit the Apache httpd.conf file in Notepad++, its located in C:\Apache24\conf\
- The Listen line should be changed to this "Listen 192.168.1.10:8081"
- The Servername line should be changed to this "ServerName 192.168.1.10:8081"
-
The following lines should be "un-commented" by removing the # at the beginning.
httpd.conf
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
- Edit your httpd-vhosts.conf file located in C:\Apache24\conf\extra\ The only lines that should not have a # in front of them are the ones listed below. Make sure to change port, servername, user name. Note, this uses the default RocketMap port of 5000.
httpd-vhosts.conf
<VirtualHost *:8081>
ServerName supermaprm.com
ErrorLog "logs/8081-error.log"
CustomLog "logs/8081-access.log" common
ProxyRequests Off
ProxyPreserveHost On
<Location />
AuthType Basic
AuthName "Restricted Files"
AuthUserFile bin/.htpasswd
Require user rmuser
ProxyPass http://localhost:5000/
ProxyPassReverse http://localhost:5000/
</Location>
</VirtualHost>
- To setup a username and password open up a CMD prompt and type the following. Change the "rmuser" to your desired user name.
cmd
cd c:\Apache24\bin (enter)
htpasswd.exe -cm .htpasswd rmuser (enter)
it will ask you for the password, then to Re-type it.
-
It puts a file called .htpasswd in c:\Apache24\bin Notice its also referenced in the httpd-vhosts.conf file, so dont move it. It encrypts the password in the file so if you look at it you wont be able to decipher the password.
-
Stop and Start Apache. You should be able to pull up RocketMap on your Windows box on both URLs.
URLs
http://127.0.0.1:5000
http://192.168.1.10:8081 (this one should prompt you for user/pass)
- In order to have people access your site on the internet you need to open holes on your firewall, or setup Port Forwarding on your router etc. I wont go into all those scenarios here.