Setting up Apache on Cygwin

Installing apache2 on Cygwin

Theoretically this should be easy, but depending on the type of webpages you’d like to run, you may require a little help from the cygwinports project, as php, django, etc are not packaged by the cygwin project.

The first step is to run the cygwin setup program and install apache2, which is located under the web programs group.

Once that is done, you need to start with the setup of the daemon. If you’ve already installed sshd, then during that process you should have created the cyg_server account that these daemons run under. If you haven’t created it, you can do so by running ‘cygserver-config’, though you will be offered the option to set it up when you configure apache anyway.

The configuration is stored in /etc/apache2/httpd.conf, and apache2 expects your webpages to be stored in /srv/www/htdocs.

That didn’t work, I get: ‘Win32 error 1062’ instead

Okay, this can be from a whole bunch of reasons, from 3rd parties packaging another version of cygwin1.dll in your path to incorrect privilege separation. The fix for me was as follows:

Next, close cygwin and start it up again with administrator rights:

Running Cygwin as Admin

Once the server starts, you should be able to go to http://localhost in a browser, and see the default page saying ‘It works!’