Subject: Cygwin 1.7.9 Apache2 startup question & issue.
From: "Brian Wilson" <[email-masked]>
To: N/[email-masked]
Cc: [email-masked]
Date: Sun, 14 Aug 2011 18:24:29 -0400
List-Id: <cygwin.cygwin.com>

I'm having a bit of trouble with starting the Cygwin Apache2 package on my Windows XP (SP3) system.   If this is not 
the correct forum please accept my apologies and point me to the correct forum when you flame me. :)  I have looked 
for a proper Cygwin User Guide for Apache2 and a Cygwin Apache2 forum; but didn't find either.  Any help in getting 
this running would be appreciated.  I believe I am close to success, but I can't seem to find the magic 
options/commands for the cygrunsrv to automatically start the httpd2 daemons.  I have attached the cygcheck.out file 
to help with the diagnosis.

Cygwin is installed for all users.  I've run rebaseall.  I have set up a restricted account(nobody)and password and 
set the properties "Deny access to this computer from the network", "Deny login locally", and "Log on as a service".  
I have run mkpasswd and verified the "nobody" entry is in /etc/passwd.  I changed the shell for the nobody account to 
/bin/false (for security) in /etc/passwd file.

I set the /etc/apache2/httpd.conf file and uncommented the existing lines to set "User nobody", and "Group None", as 
shown in the /etc/passwd file.  I also added an IfModule env_module tag to set PassEnv SYSTEMROOT.  

I have installed and configured Cygserver and it appears to be working.  When I run "/usr/sbin/apachectl2 start" from 
the Admin user account command line I see several httpd2 processes (ps -eaf output) and I can connect to the 
http://localhost default "It Works!" page just fine, so I stop the apachectl2.

When I try to get cygserver to start the service under the nobody user, nothing appears to happens (0 is the returned 
value).  The command I have used is:
$ cygrunsrv -I "CYGWIN apache2" --path /usr/sbin/apachectl2 --args "-D NO_DETACH -k start" --dep cygserver --user 
nobody --shutdown

I won't pretend to understand all details of the options as I copied this from a web site that appeared to know what 
they were doing.  After I run the cygrunsrv command, ps -eaf does not show any httpd2 processes running and I can't 
connect to the default web page.  I do see the "CYGWIN apache2" service installed under windows Services; but the 
status is blank.  If I start the service I get a message telling me the service "started then stopped"; no mention of 
any errors, but then this is windows and proper error messages aren't their style.  I can remove the CYGWIN apache2 
service with "cygrunsrv -R "CYGWIN apache2" with no trouble.

One last question.  Why does the apachectl2 help message display the usage for httpd2; and why is there no definition 
for the -k option?  These are clearly not linked file names (see the ls command sizes).

$ /usr/sbin/apachectl2 -help
Usage: /usr/sbin/httpd2 [-D name] [-d directory] [-f file]
                        [-C "directive"] [-c "directive"]
                        [-k start|restart|graceful|graceful-stop|stop]
                        [-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files

$ ls -l /usr/sbin/httpd2 /usr/sbin/apachectl2
-rwxr-xr-x 1 Brian S. Wilson root 2048 Sep 16  2007 /usr/sbin/httpd2
-rwxr-xr-x 1 Brian S. Wilson root 3363 Sep 16  2007 /usr/sbin/apachectl2

Sincerely,

Brian S. Wilson
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple