By William Jeffrey Rankin, Sun Nov 19 2023
The command line to install Cygwin's Apache as a service on Windows:
cygrunsrv -I httpd -d "Cygwin HTTPD" -p /usr/sbin/httpd.exe -a '-DNO_DETACH' -s TERM -o
-p
specifies the path, -a
the arguments passed to Apache, -s
the signal to send when the service is stopped, and -o
stops the service upon system shutdown.