본문 바로가기
OS/Window

[Window] Nginx 와 PHP-CGI 서비스 등록 (feat.nssm)

by 8ugust 2022. 2. 12.

 PC를 부팅할 때 마다 Nginx와 PHP-CGI를 실행해야만 하는 과정이 귀찮은 사용자들을 위한 글이다.

 

  TL;DR  

 

 

 


 

1. NSSM 다운로드

 

NSSM - the Non-Sucking Service Manager

NSSM - the Non-Sucking Service Manager Windows 10, Server 2016 and newer 2017-04-26: Users of Windows 10 Creators Update or newer should use prelease build 2.24-101 or any newer build to avoid an issue with services failing to start. If for some reason you

nssm.cc

 

 

 

2. CMD 에서 NSSM 설치 경로로 이동

// 글쓴이의 NSSM 설치경로
// C:\DEV\nssm-2.24\win64


// Window 운영체제 종류(32/64비트) 확인
$ wmic os get osarchitecture


// NSSM 설치 경로 이동
$ cd C:\DEV\nssm-2.24\win64

 

 

 

3. Nginx 서비스 등록

$ nssm install Nginx
// 글쓴이의 Nginx 설치 경로
// C:\DEV\nginx-1.18.0


Path : C:\DEV\nginx-1.18.0\nginx.exe
Startup Directory : C:\DEV\nginx-1.18.0
Arguments :

 

 

 

4. PHP-CGI 서비스 등록

$ nssm install Php-cgi
// 글쓴이의 PHP 설치 경로
// C:\DEV\php-7.4.27


Path : C:\DEV\php-7.4.27\php-cgi.exe
Startup Directory : C:\DEV\php-7.4.27
Arguments : -b 127.0.0.1:9000

 

 

 

 

5. 서비스 등록 여부 확인

키보드 Win + R 누르면 실행창 오픈 
방금 Install한 서비스 두 개 있는지 확인

 

 

 

6. Nginx & PHP-CGI 서비스 실행

시작버튼 클릭

 

 

 

그외 ) 서비스 삭제 방법

// 서비스를 수정하지 말고 삭제 후 다시 설치할 것
// 잘못된 경로 입력 또는 경로 변경 등
// 서비스로 등록된 서비스 명
$ sc delete Php-cgi

 

 

 

 

댓글