cygwin上运行linux软件是很方便啦,不过像httpd这样的后台守护进程,还需要一些帮助才行。
安装cygwin时选中apache httpd。
安装cygserver。(好像叫cygrunserver)
执行/usr/bin/cygserver-config。会在windows的服务中生成CYGWIN cygserver
$ /usr/bin/cygserver-config
Generating /etc/cygserver.conf file
Warning: The following function requires administrator privileges!
Do you want to install cygserver as service?
(Say "no" if it's already installed as service) (yes/no) yes
The service has been installed under LocalSystem account.
To start it, call `net start cygserver' or `cygrunsrv -S cygserver'.
Further configuration options are available by editing the configuration
file /etc/cygserver.conf. Please read the inline information in that
file carefully. The best option for the start is to just leave it alone.
Basic Cygserver configuration finished. Have fun!
启动cygserver
$ net start cygserver
CYGWIN cygserver 服务正在启动 .
CYGWIN cygserver 服务已经启动成功。
配置/etc/apache2/httpd.conf并启动apache
$ /usr/sbin/apachectl2 -k start
如果未启动cygserver直接启动apache,会发生下面错误。
/usr/sbin/apachectl2: line 78: 3088 Bad system call