How to run apache httpd in cygwin
Back>
re-run setup.exe to update tools.
At select package step, find httpd under Web category
cygwin install httpd
click next and finish the install wizard.
1. open cygwin.
2. locate the httpd start and stop program: whereis apachectl
3. start httpd: {path}/apachectl start
4. locate httpd configuration file: find / -name httpd.conf
5. from httpd.conf locate the web folder: grep -i DocumentRoot
/etc/httpd/conf/httpd.conf
6. test port 80 is open: wget localhost
7. stop httpd: {path}/apachectl graceful-stop
====================
demoAdmin@deomPC ~
$ whereis apachectl
apachectl: /usr/sbin/apachectl /usr/share/man/man8/apachectl.8.gz
demoAdmin@deomPC ~
$ /usr/sbin/apachectl start
demoAdmin@deomPC ~
$ find / -name httpd.conf
/etc/defaults/etc/httpd/conf/httpd.conf
/etc/defaults/etc/httpd/conf/original/httpd.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/original/httpd.conf
demoAdmin@deomPC ~
$ vi /etc/httpd/conf/httpd.conf
demoAdmin@deomPC ~
$ grep -i ServerRoot /etc/httpd/conf/httpd.conf
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# ServerRoot: The top of the directory tree under which the server's
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# same ServerRoot for multiple httpd daemons, you will need to change at
ServerRoot "/etc/httpd"
demoAdmin@deomPC ~
$ grep -i DocumentRoot /etc/httpd/conf/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/srv/www/htdocs"
# access content that does not live under the DocumentRoot.
demoAdmin@deomPC ~
$ cat /srv/www/htdocs/index.html
<html><body><h1>It works!</h1></body></html>
demoAdmin@deomPC ~
$ grep Listen /etc/httpd/conf/httpd.conf
# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to
#Listen 12.34.56.78:80
Listen 80
demoAdmin@deomPC ~
$ wget localhost:80
--2017-08-17 00:11:14-- http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45 [text/html]
Saving to: ‘index.html’
index.html 100%
[==================================================================
=====================================>] 45 --.-KB/s in 0s
2017-08-17 00:11:14 (574 KB/s) - ‘index.html’ saved [45/45]
demoAdmin@deomPC ~
$ cat index.html
<html><body><h1>It works!</h1></body></html>
demoAdmin@deomPC ~
$ whereis apachectl
apachectl: /usr/sbin/apachectl /usr/share/man/man8/apachectl.8.gz
demoAdmin@deomPC ~
$ /usr/sbin/apachectl graceful-stop
demoAdmin@deomPC ~
$ wget localhost:80
--2017-08-17 00:12:30-- http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.
demoAdmin@deomPC ~
$