OS X Lion: Advanced Apache configuration
Server.app's Web Service panels expose a small subset of Apache's configurable directives. Advanced administrators may need to make Web Service configuration changes beyond that subset.
There are several mechanisms for advanced configurations:
- Place global-scope directives in /etc/apache2/httpd.conf
This file is not overwritten by Server.app. Directives there are generally inherited by virtual hosts unless they are specifically overridden.
- Edit the virtual host template file in /etc/apache2/sites-disabled/default_default.conf.default. Changes in the template will be reflected in any new sites created with Server.app.
- Use the webappctl(8) and webapp.plist(8) mechanism.
This typically involves putting Apache directives in an "Include" file, creating a webapp.plist file that references the Include file, and using webappctl to enable/disable the webapp for a specific site. You can also use the Apple created plist files in /etc/apache2/webapps to enable or disable services for your own virtual hosts.
To enable WebMail for a virtual host use a command of the form:
webappctl start com.apple.webapp.webmailserver www.example.com
To disable WebMail for a virtual host use a command of the form:
webappctl stop com.apple.webapp.webmailserver www.example.com
To enable WebDAV for a virtual host use a command of the form:
webappctl start com.apple.webapp.webdavsharing www.example.com
To disable WebDAV for a virtual host use a command of the form:
webappctl stop com.apple.webapp.webdavsharing www.example.com
- Custom service
To enable a custom service for a virtual host:
- Create an "Include" file in /etc/apache2/ that includes the needed Apache directives
- Create a plist file for the service in /etc/apache2/webapps
- Use webappctl to start your newly created service
Last Modified: Aug 22, 2011