우선 구글에 nginx windows를 검색해서 나오는 링크로 들어간다.

 

http://nginx.org/en/download.html

 

nginx: download

 

nginx.org

해당 링크에서 Stable version 중 뒤에 Windows가 붙은 걸로 다운로드 한다.

 

작성일 기준으로 1.22.0이 Stable version이므로 nginx/Windows-1.22.0을 클릭해서 다운로드 받는다.

 

압축을 풀고 원하는 위치로 옮긴다.

 

nginx를 실행하려면 루트 폴더 아래에 있는 nginx.exe를 클릭해서 실행한다.

 

브라우저에서 localhost나 127.0.0.1을 주소창에 입력한다

 

 

위와 같은 화면이 나오면 설치는 끝이다.

 

nginx는 cmd에서도 실행이 가능한데, 자세한 옵션은 아래 링크에 있다.

 

http://nginx.org/en/docs/windows.html

 

nginx for Windows

nginx for Windows Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() and poll() (1.15.9) connection processing methods are currently used, so high performance and scalability should not be expected. D

nginx.org

 

\nginx 설치경로\nginx.exe -s start
  • \nginx 설치경로\nginx.exe -s start 는 nginx를 실행한다.
\nginx 설치경로\nginx.exe -s quit
  • \nginx 설치경로\nginx.exe -s quit은 nginx를 중지한다.

 

설치는 했는데, 매번 이렇게 실행하는 것도 번거로운 것 같아서 .bat 스크립트를 찾았는데, 조금 수정해봤다.

원본 스크립트는 아래 링크에 있다.

https://steemit.com/steemcodeit/@ektorcaba/start-stop-bat-script-to-nginx-for-windwos-from-steemcodeitcom

 

우선 실행이다.

 

start.bat

@ECHO OFF
ECHO Starting NGINX
start nginx.exe

popd

:loop
goto loop

cmd 창이 바로 사라지면 켜졌는지 알 수 가 없어서, 계속 켜져있게 루프 옵션을 주었다.

 

quit.bat

@ECHO OFF
nginx.exe -s quit

taskkill /f /IM php-cgi.exe
taskkill /f /IM cmd.exe
EXIT

quit을 실행하면 실행하던 start.bat 창도 같이 종료되게끔 했다.

 

reload.bat

@ECHO OFF
ECHO Starting NGINX
start nginx.exe -s reload

EXIT /b

reload는 필요할진 모르겠지만, 일단 만들어 두었다.

 

이제 해당 스크립트를 nginx 루트 폴더에 두고, 바탕화면에 바로가기하면 훨씬 편하게 쓸 수 있다.

'Web Devlope > WAS' 카테고리의 다른 글

[Nginx] 리버스 프록시를 이용한 멀티 도메인 구현  (0) 2022.08.15

+ Recent posts