Skip to content

Instantly share code, notes, and snippets.

@sftsk
Created May 2, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sftsk/8012de0ed86a5f964cdd to your computer and use it in GitHub Desktop.
Save sftsk/8012de0ed86a5f964cdd to your computer and use it in GitHub Desktop.
set up reverse proxy on osx server
I have changed the way I am doing reverse proxy on Mountain Lion Server. On my old Snow Leopard Server system, I looked at how it set-up Reverse Proxy. Configuring Reverse Proxy from the GUI, in Snow Leopard Server, added the following to the site configuration file (after the <IfModule mod_ssl.c> ~ </IfModule> section):
<IfModule mod_proxy_balancer.c>
ProxyPass / balancer://balancer-group/
ProxyPassReverse / balancer://balancer-group
<Proxy "balancer://balancer-group">
BalancerMember http://my.example.com:8080
</Proxy>
</IfModule>
Here's how I configured this. Via the GUI on Mountain Lion Server, I created a new site my.example.com and associated it to port 443; I left all the defaults. I then edited the configuration file (/Library/Server/Web/Config/apache2/sites/0000_any_443_my.example.com.conf) via the CLI, and added the lines above.
In this example, my server name is server.example.com and the website I am proxying is called my.example.com. my.example.com is running on the server.example.com host on TCP 8080 via HTTP; however, I am using the apache service to proxy https://my.example.com to http://my.example.com:8080. Completely transparant to the end user. This also allows me to ONLY open TCP 443 to the Internet and not TCP 8080. Both server.example.com and my.example.com are valid DNS records on my DNS server, obviously.
As far as an "official way", there is none that I know of... When Apple decided to simplify server management and went to Server.app vs. Server Admin, there were numerous services and configuration settings left out in favor of simplicity. This is very unfortunate, and I hope, Apple decides to add many of them back for more advanced users. DHCP was initially left out; however, was recently added back in, so, there is some promise there. Please Apple!?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment