MacPorts で Apache をインストール

インストール

MacPortsapache を検索し、最新版の 2.2.9 である「apache2」をインストールする。

$ port search apache
……
apache2                        www/apache2    2.2.9        The extremely popular second version of the Apache http server
……

$ sudo port install apache2

エラー。

こちらを参考に SQLite をいったん削除し、Apache のインストールをもう一度実行する。

$ sudo port clean --all sqlite3
$ sudo port install apache2

起動

サンプルから httpd.conf を用意する。

$ sudo cp -p /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf

launchctl での起動 + 再起動後も自動起動するように。

$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

起動確認。

$ ps -ef | grep httpd
    0 90767     1   0   0:00.01 ??         0:00.18 /opt/local/apache2/bin/httpd -k start
   70 90770 90767   0   0:00.00 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
   70 90771 90767   0   0:00.00 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
   70 90772 90767   0   0:00.00 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
   70 90773 90767   0   0:00.00 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
   70 90774 90767   0   0:00.00 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
  501 90828 90483   0   0:00.00 ttys000    0:00.00 grep httpd