Mac OS X 10.9 에 nginx 컴 파일 설치

4947 단어 nginxmac
Mac OS X 10.9 에 nginx 컴 파일 설치
일찍이 nginx 의 명성 을 들 었 습 니 다. 경량급 이 높 고 병발 하 는 특성 이 저 를 끌 어 당 겼 지만 신경 쓸 시간 이 없 었 습 니 다. 최근 에 여러 가지 이유 로 nginx 라 는 신 구 를 배 우려 고 합 니 다.자, 본론 으로 들 어가 자.오늘 은 일단 설치 해 볼 게 요.
일단 저 는 애플 의 최신 맥 을 사용 하고 있 습 니 다. OS X Mavericks 10.9 의 시스템 이기 때문에 원본 코드 를 컴 파일 하 는 방법 으로 설치 하려 고 합 니 다.
1. PCRE 라 이브 러 리 설치
여기 서 최신 버 전 을 다운로드 할 수 있 습 니 다. 저 는 8.33 버 전 을 사용 하고 터미널 에서 아래 명령 을 수행 합 니 다.
cd ~/Download
tar xvzf pcre-8.33.tar.gz cd pcre-8.12 sudo ./configure --prefix=/usr/local sudo make sudo make install

2. 설치 nginx 다운로드
먼저 nginx 홈 페이지 에서 최신 소스 코드 를 다운로드 합 니 다. 저 는 nginx - 1.5.2 를 사용 합 니 다.
tar -zvxf nginx-1.5.2.tar.gz cd nginx-1.5.2 ./configure

기본 컴 파일 개요:
Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + md5: using system crypto library
  + sha1: using system crypto library
  + using system zlib library #              (*_temp    ) nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"

편 의 를 위해:
sudo ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx sudo ln -s /usr/local/nginx/conf /etc/nginx sudo ln -s /usr/local/nginx/logs/nginx.pid /var/run/nginx.pid sudo ln -s /usr/local/nginx/logs /var/log/nginx

컴 파일 할 때 직접 설정 하기
./configure \ --prefix=/usr/local \ --sbin-path=/usr/local/sbin \ --conf-path=/etc/nginx \ --pid-path=/var/run \ --error-log-path=/var/log/nginx \ --http-log-path=/var/log/nginx

컴 파일 매개 변수 참조 Nginx InstallOption
3. Nginx 시작
PATH 환경 변수 검사
# ~/.bash_profile export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Nginx 시작
sudo nginx

Nginx 를 멈 춰 야 할 때 실행
sudo nginx -s stop

4. 자동 시작 설정
파일 생 성 /System/Library/LaunchDaemons/nginx.plist
    Labelnginx Program/usr/local/sbin/nginx KeepAlive  NetworkState  StandardErrorPath/var/log/system.log LaunchOnlyOnce    

자동 시작 파일 불 러 오기
launchctl load -F /System/Library/LaunchDaemons/nginx.plist 

좋은 웹페이지 즐겨찾기