| 914-834-2820

Setting up Apache2 on Cygwin

Check how installed Cygwin

Apache2 is going to require Cygserver which defaults to running as a Windows service. For this to work you'll have to have installed Cygwin for "All Users". Remember during the Cygwin setup you had a choice between "All Users" and "Just Me". Selecting "All Users" wlll let things like Cygserver run as the SYSTEM user.

CYGWIN Environment variable

Cygserver requires that the CYGWIN environment variable has the word 'server' in it. To verify try the following from your shell.

$ echo $CYGWIN server

If not, I set the environment variable in my Cygwin.bat file (see c:\Cygwin\Cygwin.bat).

set CYGWIN=server ntsec

Configuring Cygserver


$ /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.

Please keep in mind, that a client application which wants to use the services provided by cygserver *must* have the environment variable CYGWIN set so that it contains the word "server". So, if you don't need any other special CYGWIN setting, just set it to "server".

It is advisable to add this setting to the Windows system environment.

Basic Cygserver configuration finished. Have fun!


Control Panel -> Administrative Tools -> Services

You'll see an entry call "CYGWIN cygserver" with a status of Automatic.

You can double click on it and click on the Start button. If things go well you'll be returned to the Services window and be able to see that the CYGWIN cygserver has started.

Running Apache2

$ /usr/sbin/apachectl2 start

Important File Locations

-- httpd.conf


Verifying that Apache is running

In a browser try the following URL.


You should be happy to see a page that says "It Works"

To edit this page see the following html page on your system.



Installed as Service but doesn't start

Check that you installed Cygwin for All Users (see above). Just run Cygwin's setup program again and click "All Users" and you should be all set.