Reverse Proxy / ProxyPassReverse on Mountain Lion Server
Hello everyone!
I just purchased a new Mac Mini Server running Mountain Lion 10.8.2, to replace my old Mac Mini running Snow Leopard Server. On Snow Leopard Server, configuring a reverse proxy was simple via the GUI. In Mountain Lion Server (MLS), that option is no longer in the GUI. Here's what I want to accomlish.
I want to keep MLS's web services enabled. I have other software running, that contains it's own web server, running on a different port, say, 8080. I want to use MLS's web apache as the "front end" via port 443 (SSL) and have MLS's apache reverse proxy to the URL for my other application. This worked perfectly under Snow Leopard Server.
https://example.com <--- Should be the default website from Mountain Lion Server
https://app.example.com <--- Should be a reverse proxy to http://example.com:8080
I would sincerenly appreciate it if someone could help me out. I found this site (http://grahamgilbert.com/blog/2011/11/22/kerio-connect-vs-web-servies-in-lion-se rver/) accomplishing something similar for Lion Server; however, it does not seem to work on Mountain Lion Server (I put the config files I created below).
Thanks so much! Happy New Year!
com.example.app.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- See man pages for webapp.plist(5) and webappctl(8) for information about this example webapp.plist -->
<plist version="1.0">
<dict>
<key>includeFiles</key>
<array> <!-- Include files are activated in virtual host when webapp is started -->
<string>/Library/Server/Web/Config/apache2/httpd_app.conf</string>
</array>
<key>launchKeys</key>
<array> <!-- Launchd plists in /System/Library/LaunchDaemons are loaded when webapp is started -->
<!-- <string>com.example.mywebapp</string> -->
</array>
<key>name</key>
<string>com.example.app</string>
<key>requiredModuleNames</key>
<array> <!-- Apache plugin modules are enabled when webapp is started -->
<string>proxy_module</string>
</array>
<key>requiredWebAppNames</key>
<array> <!-- Required web apps are started when this webapp is started -->
<!-- <string>com.example.webapp.myotherwebapp</string> -->
</array>
<key>sslPolicy</key> <!-- Determines webapp SSL behavior -->
<integer>1</integer> <!-- 0: default, UseSSLWhenEnabled -->
<!-- 1: UseSSLAlways -->
<!-- 2: UseSSLOnlyWhenCertificateIsTrustable -->
<!-- 3: UseSSLNever -->
<!-- 4: UseSSLAndNonSSL -->
</dict>
</plist>
httpd_bt2.conf
<IfModule mod_proxy.c>
ProxyVia On
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
<Proxy *>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Proxy>
</IfModule>
At per the instructions via Graham's URL above, I first created a "app.example.com" website. The problem is I get the following error when trying to start the webapp, and, server.app is complaining about a corrupt web configuration.
mls:~ admin$ sudo webappctl start com.example.app app.example.com
Password:
2012-12-29 10:46:37.263 serveradmin[7303:707] xswebconfig failed: Exception:
undefined method `to_ruby' for nil:NilClass
web:error = "CANNOT_START_SERVICE_ERR"
MAC MINI SERVER (LATE 2012), OS X Server, Mountain Lion Server