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
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.
In linux is
$ sudo service apache2 restart
or
$ sudo /etc/init.d/apache2 restart
See: http://httpd.apache.org/docs/2.2/platform/windows.html#winsvc and http://httpd.apache.org/docs/2.2/platform/windows.html#wincons
You can try this one
$ service httpd restart
or
$ /etc/init.d/httpd restart
链接地址: http://www.djcxy.com/p/48534.html