What a morning. Surprise surprise…I decided to install Mac OS X Server on my PowerBook to play around with the Apache conf (since I legally own two copies that just sit in my drawer). Ever since Mac OS X Server 1.0 came out I was excited to use Mac OS X Server. I loved AppleShare IP, and was ready to learn something new. Yeah, you are right, how many times can I tell this story?
To the point: you have web sites that need to be hosted in a Mac environment…what do you do? Two options (not including Darwin): Mac OS X Client, Mac OS X Client. I took my standard Mac OS X Client conf file and went line by line to see how the conf file was modified for Mac OS X Server. I will give credit to Apple for cleaning up the conf from 10.2 to 10.3, but man, it still leaves a lot of room for improvement. First of all….let me break down the conf files that Mac OS X Server uses.
- httpd.conf – The main configuration file that should contain all the basics. I have not figured out exactly why Apple has arranged the configuration file so…wierdly (not putting some basic directives like port number, listen, etc) but I am trying. At the end of standard Apache conf files, there is a Virtual Host template where ordinarily you would put all of your Virtual Host directives.
- virtual_host_global.conf – Apple decided to create a folder “sites” for all their vhost (Virtual Host) files, which is acceptable. There is also a conf file in the “sites” directory which does not make sense to me. The file is called “virtual_host_global.conf” and has one or two lines, depending if you want to use the performance cache. If you use the standard configuration from Apple, the “virtual_host_global.conf” contains one line:
If you chose to not use the performance cache, the file then looks like:
- 0000_any_80_default.conf – Apple’s conf files for all virtual hosts (even if you only host one site, it is treated as a vhost). All site specific information (from the Server Admin) is located in this/these files. Good: Apple separated them out for easy editting. Bad: don’t expect your changes to stick if you edit them by hand and then do something in the Server Admin. Also, WARNING if you use SSL, make sure you use Apple’s SSL files, or you will face the wrath when ediing your SSL and non SSL files (see old post)
What I would recommend if you have to use Mac OS X Server for your web needs, but feel it does not quite cut it…?
- Ask me for my httpd.conf file that I finally got to work that uses 95% standard Apache directives straight from the default Apache conf (5% of OS X Server stuff). I went line by line to see what it takes to break Mac OS X Server’s Apache conf. I rearranged the conf file to look more like the default conf as well as commented all my changes. My conf file does not use any of Apple’s vhost files, and you have a very simple, easy to follow example of vhosts.
- If you do not need a completely new httpd.conf file but would like to actually have the directives in the indivual site conf files to stick, create a conf file with your custom directives and then add an “Include “/etc/httpd/mychanges.conf” line at the end of the httpd.conf. Next time you restart your custom directives will be added and Apple will not be able to touch them.
- If you need complete control of your Apache install but still need to use Mac OS X Server for other server processes (AFP/FTP/Samba/Mail/DNS, etc) I would recommend downloading and compiling Apache into a different directory (ex. /usr/local) so you can control all your modules, conf files, etc.
- If you really are unhappy with Mac OS X Server’s web serving set up and do not need any other Mac OS X Server services, and do not want to worry about compiling, recompiling, and making sure Apple does not touch your custom configuration, I would at this point recommend running Apache on Mac OS X Client. Apple maintains updating Apache and does not touch the conf files with any GUI application. You can fully customize the conf file and not worry about too much because everything is standard Apache.
Something to think about…