nginx를 다운 받아서 설치한다. 필요한 옵션을 추가한다.
1 2 3 4 5 6 |
# nginx 소스 설치 ./configure \ --with-http_mp4_module \ --with-http_image_filter_module make sudo make install |
/usr/local/nginx 디렉토리에 nginx가 설치됐다.
이제 nginx를 재부팅 후에도 실행될 수 있게, 서비스를 만들겠다. 다음과 같이 plist 파일을 하나 만든다.
/Library/LaunchDaemons/local.nginx.plist:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>local.nginx</string> <key>ProgramArguments</key> <array> <string>/usr/local/nginx/sbin/nginx</string> <string>-g</string> <string>daemon off;</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <false/> <key>WorkingDirectory</key> <string>/usr/local/nginx</string> </dict> </plist> |
시작 서비스로 등록한다.
1 2 |
sudo launchctl load -w /Library/LaunchDaemons/local.nginx.plist sudo launchctl start local.nginx |
서비스를 해제하는 방법이다.
1 2 3 4 5 |
sudo launchctl stop local.nginx sudo launchctl unload -w /Library/LaunchDaemons/local.nginx.plist # 확인 sudo launchctl list |
언인스톨하기
1 2 3 |
# 지우기 sudo rm -rf /Library/LaunchDaemons/local.nginx.plist sudo rm -rf /usr/local/nginx |