Finally I got PlexConnect running on my Mac Mini with OS X Server =D
(Also confirmed to work on Mountain Lion 10.8 and Mavericks 10.9, I've updated the guide accordingly where there're differences.)
Updated by f00b4r on 16 December 2013 - Added fix for "/" issue and removed automator applet details as launchctl is now supported in code (see "support/osx" sub folder)
Update, june 16 - The latest version of PlexConnect and the updated settings file has made it easier for us. Along with the addition to our site config from ignipotentis (#29) there's no need to edit any of the PlexConnect scripts anymore which makes our future updates much easier =)
Note there is an alternate method here by Xwk88 that uses a virtual interface rather than vhosts here (note the caveats though):
EDIT: The issue about having to start PlexConnect first using Xwk88's method has been resolved in this post.
I use my own DNS service and I can still use the web server and host other webpages while PlexConnect is running.
So here's how:
1. Download a fresh copy of PlexConnect.
2. Run the PlexConnect.py script once in the terminal to create the settings.cfg file. Then hit CTRL+enter to end the script
3. Edit the settings.cfg file,
set ip_pms to the ip of your PlexMediaServer
set ip_dnsmaster to the ip of your DNS-server (in my case these two are the same)
set enable_dnsserver to "false" (without the quotes)
set port_webserver to "9999" (without the quotes)
4. Now we have to edit the file webserver.py. First we change the port it's working on from 80 (as this conflicts with our own web server). I changed it to port 9999. 5. The second change to webserver.py is made to stop the plexconnect web server from checking if it's really an appletv it's serving or any other device. As we later on will forward and return appletv-requests from our webserver to the plexconnect webserver we don't want evil error 403-messages we want nice XML-files to serve our apple-tv with Replace the lines I've selected in the picture with if self.headers['User-Agent'].startswith(""): Before: After:
6. That's it with the plexconnect script. Fire it up and make sure everything works as it's supposed to.
You should get the message "WebServer : WebServer: Serving HTTP on YOUR_IP_ADDRESS port 9999."
If you open safari and enter http://localhost:9999 the result is supposed to be an error 403 page which says your device isn't served by PlexConnect. (We'll deal with that later)
PlexConnect is working as it's supposed to =) Lets move on!
7. Now it's time to fix our DNS-server. As I use Lion server I use Server Admin. DNS is integrated in Server App if you use 10.8. (Setting up DNS in Mavericks Server developer preview - read notes in Nevirs' post #96)
Add a new zone and machine record as the image shows. trailers.apple.com is where the ATV makes its request. 10.0.1.4 is the IP of my server, just replace it with whatever fits your server and hit Save.
8. Open server app, go to the web section. Click the plus icon and enter settings as shown in the picture. trailers.apple.com and port 80. Then I just created a folder named trailers to use as document root. Click done! Now we have the dns ready and a website to serve the apple TV with the information needed to use plexconnect.
9. If you open safari you can still use your all other web sites. If you enter trailers.apple.com you will get a no access message as there are nothing present in the folder you choose to use for keeping the files in.
Our DNS and the website that's supposed to serve the ATV is working! Now it's time to connect our website with the plex connect webserver running on port 9999.
10. To make the connection between trailers.apple.com and the webserver we have to edit the config file for the website we just created in the server app.
Open up terminal and cd to "/etc/apache2/sites" (OS X Server 10.7) or "/Library/Server/Web/Config/apache2/sites/" (OS X Server 10.8), then ls in the list you will find a file named "0000_any_80_trailers.apple.com.conf" this is the file we have to edit.
enter the command sudo vi 0000_any_80_trailers.apple.com.conf hit enter and type in your password then enter again.
move the cursor down to the bottom of the file between the and tags. Hit the "i" button on your keyboard and enter the text marked in grey in the picture.
RequestHeader set User-Agent AppleTV
ProxyPass / http://trailers.apple.com:9999/ nocanon
ProxyPassReverse / http://trailers.apple.com:9999/
Be sure to get all the / right and don't forget the ones at the end of the lines otherwise this won't work.
When you're finished with the text hit "esc" and then "ZZ" (note Z not z).
What we use here is a reverse proxy. When a request arrives to our server - trailers.apple.com at port 80 these lines tells apache that we want another resource to serve this request in your case the plexconnect web server which is running at port 9999. So apache forwards the request for trailers.apple.com gets an answer from plexconnect and nicely returns it back to our AppleTV which has no clue it actually got its XML file from the server at port 9999 instead of port 80 as it requested ;-)
10. Go back to the server app and make sure to reboot your web server. (Turn off and then on again)
11. Now you can try the setup by entering trailers.apple.com in safari and the result should be a blank page which has all the XML in it if you view the source.
If this is the case everything is working as it should, PlexConnect is running on your server at the same time as you can host your own dns and websites without any interruptions.
12 It's time to move over to the ATV. Edit DNS-settings in the ATV and point them to your server (dns-server) In my case I use my OS X server as the standard DNS-server so I left the default dns-setting in my ATV. But just change it to the right IP for your config.
13. Go back to the home screen and enter trailers. Voila PlexConnect running on OS X Server =)
14. If you want to have PlexConnect automatically start at boot then look in the "support/OSX" folder to have launchctl automatically start it without requiring an admin password to be entered each time or to saved anywhere.
That's it!!! :-D