Proxying internal websites via OS X Server
04/08/17 17:12 Filed in: Systems Administation | OS X
Proxying internal websites via OS X Server
After rearranging my network to use an OS X server for my main web server there were a few web based systems that I need to expose to the outside world. The advice on Reverse Proxy with macOS Server (http://stationinthemetro.com/2017/05/02/reverse-proxy-with-macos-server) by Mark Boszko worked for me.
I am reproducing the core of the article Reverse Proxy with macOS Server in case the original should cease to be available:
To proxy the internal system site2.example.com (site2) with IP address 192.168.1.15.
Create a web app configuration file on the macOS Server machine
/Library/Server/Web/Config/apache2/httpd_site2webapp.conf:
ProxyPreserveHost On
ProxyPassReverse / http://192.168.1.15:80/
ProxyPass / http://192.168.1.15:80/
ServerName site2.example.com
and the plist file which refers to the conf file
/Library/Server/Web/Config/apache2/webapps/com.example.site2webapp.plist:
includeFiles
/Library/Server/Web/Config/apache2/httpd_site2webapp.conf
name
com.example.site2webapp
displayName
site2WebApp
installationIndicatorFilePath
/Library/Server/Web/Config/apache2/httpd_site2webapp.conf
sslPolicy
0
Ensure that the files are owned by root and group wheel with permissions 644.
And then add the new domain to the server by:
Please refer to the original article (http://stationinthemetro.com/2017/05/02/reverse-proxy-with-macos-server) from which I have copied the example and a significant portion of the text for more detail.
To proxy the internal system site2.example.com (site2) with IP address 192.168.1.15.
Create a web app configuration file on the macOS Server machine
/Library/Server/Web/Config/apache2/httpd_site2webapp.conf:
ProxyPreserveHost On
ProxyPassReverse / http://192.168.1.15:80/
ProxyPass / http://192.168.1.15:80/
ServerName site2.example.com
and the plist file which refers to the conf file
/Library/Server/Web/Config/apache2/webapps/com.example.site2webapp.plist:
Ensure that the files are owned by root and group wheel with permissions 644.
And then add the new domain to the server by:
- In the Websites tab of Server.app, click the + below the Websites to add a new site
- Enter site2.example.com for Domain Name
- Leave everything else as default
- Click Edit Advanced Settings…
- Under the section “Make these web apps available on this website:” check Enable for site2WebApp
- Click OK
- Click Create
Please refer to the original article (http://stationinthemetro.com/2017/05/02/reverse-proxy-with-macos-server) from which I have copied the example and a significant portion of the text for more detail.