Skip to content

Instantly share code, notes, and snippets.

@hyrious
Last active January 31, 2022 09:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyrious/9d8f02d347da56801acb9f561a5b062f to your computer and use it in GitHub Desktop.
Save hyrious/9d8f02d347da56801acb9f561a5b062f to your computer and use it in GitHub Desktop.
Nginx on Windows
@echo off
pushd "%~dp0"
cd ..
if "%*" == "" (
tasklist /fi "ImageName eq nginx.exe" |find "nginx.exe" >nul
if errorlevel 1 (
start /b nginx.exe
) else (
echo nginx.exe is already running. Nothing todoy.
)
) else if "%*" == "-l" (
tasklist /fi "ImageName eq nginx.exe"
) else call nginx.exe %*
popd
@hyrious
Copy link
Author

hyrious commented Jan 31, 2022

How to use

Put it in the contrib folder in Nginx For Windows. Then add that folder to PATH.

nginx.exe
contrib/      <-- add this folder to PATH
    nginx.cmd

Commands

: start an nginx daemon
nginx
: show running nginx processes
nginx -l
: send signal to nginx process
nginx -s stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment