Apache configuration on MacOS X 10.5.8

Base configuration:

  • Use the Server Admin Tool to navigate to “server.local” and stop all services except:
    • firewall, web, open directory
  • Stop the mailinglists service, so that it cannot block Postfix:
    • sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.wikid.mailinglists.plist

SSH configuration:

  • Allow X11 Forwarding per SSH: /etc/sshd_config → “X11Forwarding yes”
  • Set the timeout of SSH connections to 24h in /etc/sshd_config:
ClientAliveInterval 120
ClientAliveCountMax 720
  • Disable SSH timeout on the client-side in ~/.ssh/config:
ServerAliveInterval 60

Web Server configuration:

  • Web server documents root is: /srv/www/
  • Web server documents need to have group and user “_www”
  • Show installed modules: /usr/sbin/apachectl -M
  • Show CUPS info: http://localhost:631 erreichbar.
  • Web Server config file is: /etc/apache2/httpd.conf
  • Changes with respect to base installation:
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule bw_module libexec/apache2/mod_bw.so

AddType video/ogg ogv
AddType video/ogg ogg
AddType video/webm .webm

GracefulShutDownTimeout 1000

MinSpareServers 8
MaxSpareServers 32
StartServers 1
MaxKeepAliveRequests 500
KeepAliveTimeout 5
MaxClients 512
ListenBackLog 256

Web Server PHP configuration:

  • /etc/php.ini
  • Changes with respect to base installation:
post_max_size = 1000M
upload_max_filesize = 1000M

Put robots.txt in documents root:

  • /srv/www/robots.txt
User-agent: *
Disallow: /one/directory/at/a/time/

Restart Apache gracefully:

sudo /usr/sbin/apachectl -k graceful # httpd.conf: GracefulShutDownTimeout 1000

Restart Apache immediately:

sudo /usr/sbin/apachectl -k restart

Reboot the server:

sudo /usr/sbin/apachectl -k graceful-stop
sudo /usr/sbin/apachectl -k stop
sudo shutdown -r now

Server Shutdown:

sudo /Volumes/schorsch/data/mirror.sh
sudo /usr/sbin/apachectl -k graceful-stop
sudo shutdown -h +10

To disable Apache completely (httpd is restarted automatically after some time):

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

See also suEXEC, PostFix and svnserve configuration.