MacPortsでApache2をインストール
Macportsを使ってapache2をインストールしてやる。
Leopardにデフォルトでついてくるapacheも2.xなので別にそのまま使ってもいいし、postfixもBINDもデフォルトのものを使ってるのになんでapacheだけと思わないでもないが、バージョンとかを頻繁に更新したいソフトは全部Macportsでインストールすることにする。
インストール
[yuanying@Kohrin ~]$sudo port install apache2 ---> Fetching apache2 ---> Verifying checksum(s) for apache2 ---> Extracting apache2 ---> Applying patches to apache2 ---> Configuring apache2 ---> Building apache2 with target all ---> Staging apache2 into destroot ---> Creating launchd control script ########################################################### # A startup item has been generated that will aid in # starting apache2 with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist ########################################################### Warning: apache2 requests to install files outside the common directory structure! ---> Installing apache2 2.2.6_0 ---> Activating apache2 2.2.6_0 ---> Cleaning apache2
例のごとく自動起動用のplistが/Library/LaunchDaemonsに保存される。
設定
サンプルのconfファイルをコピーして編集する。
[yuanying@Kohrin ~]$cd /opt/local/apache2/conf/ [yuanying@Kohrin conf]$sudo cp httpd.conf.sample httpd.conf Password:
とりあえずuserdirを有効にしてやる。
/opt/local/apache2/conf/httpd.conf
httpd.confの最後の方でInclude conf/extra/httpd-userdir.confにかかっているコメントを外してやる。
# User home directories Include conf/extra/httpd-userdir.conf
起動
起動して確認する。
[yuanying@Kohrin conf]$/opt/local/apache2/bin/apachectl start httpd: Syntax error on line 96 of /opt/local/apache2/conf/httpd.conf: Cannot load /opt/local/apache2/modules/mod_ssl.so into server: Symbol not found: _ssl_cmd_SSLCACertificateFile\n Referenced from: /opt/local/apache2/modules/mod_ssl.so\n Expected in: flat namespace\n
エラー。
なんかTigerだと起きてなかったみたいですねこれ。
仕方がないのでこのバグが直るまでmod_sslをロードしてる行をコメントアウト。
... LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule ssl_module modules/mod_ssl.so LoadModule mime_module modules/mod_mime.so ...
起動して確認。
[yuanying@Kohrin conf]$sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist [yuanying@Kohrin conf]$ps aux | grep apache2 _www 68100 0.0 0.1 604624 1156 ?? S 4:55PM 0:00.00 /opt/local/apache2/bin/httpd -k start _www 68099 0.0 0.1 604624 1156 ?? S 4:55PM 0:00.00 /opt/local/apache2/bin/httpd -k start _www 68098 0.0 0.1 604624 1156 ?? S 4:55PM 0:00.00 /opt/local/apache2/bin/httpd -k start _www 68097 0.0 0.1 604624 1156 ?? S 4:55PM 0:00.00 /opt/local/apache2/bin/httpd -k start _www 68096 0.0 0.1 604624 1156 ?? S 4:55PM 0:00.00 /opt/local/apache2/bin/httpd -k start root 68095 0.0 0.2 604624 2104 ?? Ss 4:55PM 0:00.01 /opt/local/apache2/bin/httpd -k start root 68091 0.0 0.1 75384 700 ?? Ss 4:55PM 0:00.01 /opt/local/bin/daemondo --label=apache2 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart ; --pid=none yuanying 68103 0.0 0.0 599780 444 s000 R+ 4:55PM 0:00.00 grep apache2
おk。