Cygwin で Apache2 をサービスとして起動

cygserver をサービスとして起動

まず cygserver をサービスとして起動する必要があります。次のコマンドを実行してください。

cygserver-config

Do you want to install cygserver as service?
(Say "no" if it's already installed as service) (yes/no) 
とでますので

yes

と打ち込んでください。

次に chmod, chown, chgrp などのコマンドを使って以下のようになるようする

$ cd /var/log
$ ls -l httpd2.log
-rw-r----- 1 SYSTEM root 3394 May  3 01:06 httpd2.log
$  cd /var/log/apache2
$ ls -l
-rw-r----- 1 SYSTEM root  9992 May  4 02:51 access_log
-rw-r----- 1 SYSTEM root 16517 May  4 03:06 error_log

/etc/apache2/httpd.config の書き換え

# User home directories
# Include /etc/apache2/extra/httpd-userdir.conf
の 下の # を取り
# User home directories
Include /etc/apache2/extra/httpd-userdir.conf
とする。
# Local access to the Apache HTTP Server Manual
# Include /etc/apache2/extra/httpd-manual.conf
の 下の # を取り
# Local access to the Apache HTTP Server Manual
Include /etc/apache2/extra/httpd-manual.conf

apache2 のサービス登録と開始

httpd2 という名前で登録し開始します。
$ cygrunsrv -I httpd2 -d "CYGWIN httpd2" -p /usr/sbin/httpd2 -a\
>  "-DNO_DETACH" -y cygserver -e "CYGWIN=ntsec server" -s TERM -o
$ cygrunsrv -S httpd2

参考 URL

http://d.hatena.ne.jp/zmi/
http://blog.livedoor.jp/yuhiwa/archives/51586323.html
http://www.kentan.jp/kentan/linux/vinelinux4.1/apache2/setting.html
http://uenox.ld.infoseek.co.jp/cygwin/apache.html
http://himazu.blogspot.com/2008/03/cygwinapache2.html
http://www5d.biglobe.ne.jp/~y0ka/cat_cygwin.html

2008 年 5 月 5 日に作成

inserted by FC2 system