Search code examples
apachecygwin

How to restart apache server through cygwin and ssh


The scenario is this: I have an Apache web server installed on a Windows 7 machine. The same machine has cygwin installed, and cygwin is configured with ssh. This allows me to ssh into cygwin remotely, and then, through cygwin, I can access other files on this computer (even those not in cygdrive).

My question: How can I restart the web server through cygwin if I am accessing it remotely through ssh? Is it possible? Thanks


Solution

  • If your service is called Apache, then like this:

    ssh machine "net stop Apache; net start Apache"
    

    Sometimes it is called Apache2 or httpd, depending on your distro.