Using Cygwin to run nginx on Windows

0

0

Is it possible to run a Linux installation of nginx from Cygwin? Or should I run the Windows version? Basically I want to be able to restart Cygwin from command prompt instead of having to end the process in the task manager when I change the config file. Windows nginx doesn't support this but Linux nginx does.

ford prefect

Posted 2014-06-04T15:36:46.377

Reputation: 227

Answers

3

If all you want to do is restart something from the command line in Windows, you can terminate a running process via command line with the taskkill command, or the stop-process cmdlet in Powershell.

I don't see nginx in list of Cygwin packages so you'd have to download the nginx sources and compile under cygwin for it to work.

LawrenceC

Posted 2014-06-04T15:36:46.377

Reputation: 63 487

1

I use the chocolatey package manager with nginx-service for running nginx on Windows.
It uses nssm to manage nginx as a service.

Then, it's as simple as opening cmd and 'nssm restart nginx-service' to restart nginx.
Installation is by loading chocolatey, restarting your terminal and doing

choco install nginx-service

Note:
I am fully aware that this is running the natively compiled for Windows nginx, not a version compiled against Cygwin. However, it performs all the tasks needed very well.

Miles Prower

Posted 2014-06-04T15:36:46.377

Reputation: 11

-1

Updating this because this is the first entry for "cygwin start nginx" when searching with google.

  • It is not "a Linux installation of nginx from Cygwin". It is a version of nginx compiled against the libraries that are compiled against the cygwin DLLs. See: https://cygwin.com/index.html

  • Since Cygwin provides a version, it better be possible.

  • The nginx binary is in /usr/sbin. That doesn't show up in your path unless you add it.

  • According to http://nginx.org/en/docs/windows.html you can do this at the windows console, just like the Cygwin console:


    nginx -s stop   fast shutdown
    nginx -s quit   graceful shutdown
    nginx -s reload changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
    nginx -s reopen re-opening log files

(OK, so "code blocK doesn't behave the way I'd expect. Had to tag it manually)

  • Accordingly the answer to MY question (dropped here so that others might benefit):

/usr/sbin/nginx.exe

Petro

Posted 2014-06-04T15:36:46.377

Reputation: 119

This sounds like your question is slightly different, this means the community would be better served by you submitting your own question, then answering it yourself. – Ramhound – 2017-07-14T22:14:39.430

Google sent me here, and my question was REALLY dumb. As in brain fart dumb.

I don't know what it takes to change Google's mind. Because Google. – Petro – 2017-07-14T22:18:35.510

Be sure your answer, addresses the author's question, and isn't an answer to your question (which while similar isn't actually the author's question). – Ramhound – 2017-07-14T22:50:34.683