MacPort 로 nginx 설치하기

MacPort로 nginx 설치하기

MacPort 는 설치된 상태로 가정함.
sudo 를 통해 관리자 권한을 얻은 상태로 가정함.


1. 설치

설치는 다음 명령을 실행하는것으로 끝.

port install nginx


진짜 끝임...


긑데 중간에 의존성 있는 애들이 설치가 안될때가 있음. 이럴땐 에러 메시지가 나올때에 친절하게 어떻게 하면 해결할 수 있는지도 알려줌. 예를 들면 이런식.

Error: /opt/local/lib/libz.dylib is not in the destroot. Please clean zlib and try again.


그런 다음 끝날때에 보면 이런 말이 나옴.

###########################################################
# A startup item has been generated that will aid in
# starting nginx with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load nginx
###########################################################

이건 launchd에 등록해준다는 말이다. 부팅 되면 바로 실행되게 하고싶으면 port load nginx 를 실행하면 된다.


2. 설정

nginx 설정파일은 /opt/local/etc/nginx 여기에 있다. 경로에 접근해보면 기본 환경설정 파일인 nginx.conf 가 설정되어 있지 않고 nginx.conf.example 가 준비되어 있다. 요놈을 복사해서 쓰면 되겠다.


그리고 시작, 종료, 재시작을 위해서 alias를 등록해주자.

vi ~/.profile
alias nginxstart='sudo launchctl load /Library/LaunchDaemons/org.macports.nginx.plist'
alias nginxstop='sudo launchctl unload /Library/LaunchDaemons/org.macports.nginx.plist'
alias nginxrestart='nginxstop; nginxstart;'

수정한 후 적용하려면

. ~/.profile


끝!


' > 코드' 카테고리의 다른 글

pip 설치  (0) 2012.06.26
MacPort 로 MySQL 설치하기  (0) 2012.04.06
MacPort 설치  (0) 2012.04.06