UPDATE: With the release of 10.7.3, you can now do this via "Server.app", so i'd advise against the below method. If you have used the below & upgraded to 10.7.3 & have an error in "Server.app" when managing the web service, click here.
Port redirection is (simply put), where an end user enters: http://mygreatwebsite.com & they are redirected to http://mygreatwebsite.com:(someport).
On Snow Leopard server you could easily set port redirects from within the Server Admin.app, but in Lion server this has all been changed.
The basics of how to enable virtual hosts on Lion server, is covered in this post. As well as links to the more advanced options.
Once Virtual Hosts have been enabled, editing /private/etc/apache2/extra/httpd-vhosts.conf enable the redirects.
For this example we’ll take the Jamf Software Server (read: JSS). By default, it hosts it’s HTTP service on port 9006. The URL for the JSS in this example is http://jss.mycompany.com:9006.
What we wish to achieve is that when users enter http://jss.mycompany.com into a browser, they are redirected to http://jss.mycompany.com:9006.
- In Terminal type:
sudo nano /private/etc/apache2/extra/httpd-vhosts.conf
2. Press Enter
3. Under the section “Use name-based virtual hosting.”
4. Enter: “NameVirtualHost jss.mycompany.com:*”
5. Press Enter
6. In the VirtualHost section enter the below:
7. Press “CTRL + X”
8. Press “Y”
9. Press Enter
10. Restart the Web service (flick the switch!)
In step 3 the server is listening for connections via the dns entry jss.mycompany.com.
In step 4 the server is redirecting all port 80 (read; HTTP) connections via the dns entry jss.mycompany.com to http://jss.mycompany.com:9006.
One thought on “How To: Port Redirect Web Traffic On Lion Server”