Nginx 의 업그레이드 와 제어 명령
[root@zhu1 ~]# /opt/nginx/sbin/nginx -v
nginx version: nginx/1.2.8
2. 새 버 전 다운로드, 압축 풀기 컴 파일
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
원래 의 컴 파일 파 라 메 터 를 보고 같은 매개 변수 로 새로운 버 전 을 컴 파일 합 니 다.
[root@zhu1 ~]# /opt/nginx/sbin/nginx -V
nginx version: nginx/1.2.8
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)
TLS SNI support disabled
configure arguments: --prefix=/opt/nginx --with-poll_module --with-http_gzip_static_module --with-http_ssl_module --with-http_stub_status_module
[root@zhu1 nginx-1.4.2]# ./configure --prefix=/opt/nginx --with-poll_module --with-http_gzip_static_module --with-http_ssl_module --with-http_stub_status_module
make 를 실행 하지만 make 를 실행 하지 마 세 요. install
[root@zhu1 nginx-1.4.2]# make
3. 원래 nginx 프로그램 백업
[root@zhu1 nginx-1.4.2]# cp /opt/nginx/sbin/nginx /opt/nginx/sbin/nginx.bak
obbs 디 렉 터 리 에 새 버 전의 nginx 프로그램 이 있 습 니 다.
[root@zhu1 nginx-1.4.2]# \cp objs/nginx /opt/nginx/sbin/nginx
cp: “/opt/nginx/sbin/nginx”:
[root@zhu1 nginx-1.4.2]# killall nginx
[root@zhu1 nginx-1.4.2]# \cp objs/nginx /opt/nginx/sbin/nginx
프로필 이 올 바른 지 테스트 하고 현재 버 전 을 시작 하고 확인 합 니 다.
[root@zhu1 nginx-1.4.2]# /opt/nginx/sbin/nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
[root@zhu1 nginx-1.4.2]# /opt/nginx/sbin/nginx
[root@zhu1 nginx-1.4.2]# /opt/nginx/sbin/nginx -v
nginx version: nginx/1.4.2
**************************************************
다음은 부 드 러 운 업 그 레이 드 를 사용 합 니 다.
1. 새 버 전의 nginx 프로그램 복사
[root@zhu1 nginx-1.4.2]# cp objs/nginx /opt/nginx/sbin/nginx
2. 부 드 러 운 업그레이드 nginx 실행 프로그램
[root@zhu1 nginx-1.4.2]# kill -USR2 `cat /opt/nginx/logs/nginx.pid`
[root@zhu1 nginx-1.4.2]# ll /opt/nginx/logs/
1064
-rw-r--r-- 1 root root 1049596 08-22 07:57 access.log
-rw-r--r-- 1 root root 2010 08-25 06:45 error.log
-rw-r--r-- 1 root root 16427 08-25 04:54 host.access.log
-rw-r--r-- 1 root root 6 08-25 06:45 nginx.pid
-rw-r--r-- 1 root root 6 08-25 06:35 nginx.pid.oldbin
3. 원래 nginx. pid 파일 이 nginx. pid. oldbin 으로 변 합 니 다.ps 를 통 해 두 개의 nginx 메 인 프로 세 스 가 있 음 을 알 수 있 습 니 다.
[root@zhu1 nginx-1.4.2]# ps -ef | grep nginx
root 25992 1 0 06:35 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
www 25993 25992 0 06:35 ? 00:00:00 nginx: worker process
www 25994 25992 0 06:35 ? 00:00:00 nginx: worker process
www 25995 25992 0 06:35 ? 00:00:00 nginx: worker process
www 25996 25992 0 06:35 ? 00:00:00 nginx: worker process
www 26005 1 0 06:38 ? 00:00:00 nginx: worker process
www 26006 1 0 06:38 ? 00:00:00 nginx: worker process
www 26007 1 0 06:38 ? 00:00:00 nginx: worker process
www 26008 1 0 06:38 ? 00:00:00 nginx: worker process
root 26028 25992 0 06:45 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
www 26029 26028 0 06:45 ? 00:00:00 nginx: worker process
www 26030 26028 0 06:45 ? 00:00:00 nginx: worker process
www 26031 26028 0 06:45 ? 00:00:00 nginx: worker process
www 26032 26028 0 06:45 ? 00:00:00 nginx: worker process
root 26037 2262 0 06:46 pts/0 00:00:00 grep nginx
4. 오래된 nginx 프로 세 스 닫 기
[root@zhu1 nginx-1.4.2]# kill -QUIT `cat /opt/nginx/logs/nginx.pid.oldbin`
[root@zhu1 nginx-1.4.2]# ps -ef | grep nginx
root 26072 1 0 06:48 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
www 26073 26072 0 06:48 ? 00:00:00 nginx: worker process
www 26074 26072 0 06:48 ? 00:00:00 nginx: worker process
www 26075 26072 0 06:48 ? 00:00:00 nginx: worker process
www 26076 26072 0 06:48 ? 00:00:00 nginx: worker process
root 26110 2262 0 06:49 pts/0 00:00:00 grep nginx
5. 승급 성공 여부 확인
[root@zhu1 nginx-1.4.2]# /opt/nginx/sbin/nginx -v
nginx version: nginx/1.4.2
nginx 제어 명령 어
1. 설정 파일 이 올 바른 지 확인
[root@zhu1 ~]# /opt/nginx/sbin/nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
[root@zhu1 ~]# /opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
2. 버 전 보기
[root@zhu1 ~]# /opt/nginx/sbin/nginx -v
nginx version: nginx/1.4.2
3. 컴 파일 매개 변수 보기
[root@zhu1 ~]# /opt/nginx/sbin/nginx -V
nginx version: nginx/1.4.2
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)
TLS SNI support disabled
configure arguments: --prefix=/opt/nginx --with-poll_module --with-http_gzip_static_module --with-http_ssl_module --with-http_stub_status_module
4. 신호 제어 프로 세 스 를 통 해
kill -시그 널 `cat /opt/nginx/logs/nginx.pid`
상용 신호:
QUIT :현재 요청 을 처리 한 후 프로 세 스 를 닫 습 니 다.
[root@zhu1 ~]# /opt/nginx/sbin/nginx
[root@zhu1 ~]# ps -ef | grep nginx
root 26153 1 0 07:00 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
www 26154 26153 1 07:00 ? 00:00:00 nginx: worker process
www 26155 26153 1 07:00 ? 00:00:00 nginx: worker process
www 26156 26153 1 07:00 ? 00:00:00 nginx: worker process
www 26157 26153 1 07:00 ? 00:00:00 nginx: worker process
root 26160 2262 0 07:00 pts/0 00:00:00 grep nginx
[root@zhu1 ~]# kill -QUIT `cat /opt/nginx/logs/nginx.pid`
[root@zhu1 ~]# ps -ef | grep nginx
root 26163 2262 0 07:00 pts/0 00:00:00 grep nginx
HUP :설정 을 다시 불 러 옵 니 다. 원래 프로 세 스 를 닫 고 새 프로 세 스 를 시작 합 니 다. 이 동작 은 사용자 의 접근 요청 을 중단 하지 않 습 니 다.
[root@zhu1 ~]# kill -HUP `cat /opt/nginx/logs/nginx.pid`
USR1 :nginx 로그 전환 에 사용 합 니 다. 로그 파일 을 다시 여 는 것 입 니 다. 매일 로그 파일 을 만 들 려 면 이 신호 로 제어 하 십시오.
USR2 :실행 가능 한 프로그램 을 부 드 럽 게 업그레이드 하 는 데 사용 합 니 다.
WINCH :작업 프로 세 스 를 여 유 롭 게 닫 습 니 다.
[root@zhu1 ~]# ps -ef | grep nginx
root 26250 1 0 07:03 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
www 26251 26250 4 07:03 ? 00:00:00 nginx: worker process
www 26252 26250 4 07:03 ? 00:00:00 nginx: worker process
www 26253 26250 4 07:03 ? 00:00:00 nginx: worker process
www 26254 26250 4 07:03 ? 00:00:00 nginx: worker process
root 26256 2262 0 07:03 pts/0 00:00:00 grep nginx
[root@zhu1 ~]# kill -WINCH `cat /opt/nginx/logs/nginx.pid`
[root@zhu1 ~]# ps -ef | grep nginx
root 26250 1 0 07:03 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 26259 2262 0 07:03 pts/0 00:00:00 grep nginx
[root@zhu1 ~]# ps -ef | grep nginx
root 26250 1 0 07:03 ? 00:00:00 nginx: master process /opt/nginx/sbin/nginx
root 26261 2262 0 07:03 pts/0 00:00:00 grep nginx
[root@zhu1 ~]# netstat -lntp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26250/nginx
5. nginx 의 시작
[root@zhu1 ~]# /opt/nginx/sbin/nginx
nginx 의 닫 기
[root@zhu1 ~]# kill -QUIT `cat /opt/nginx/logs/nginx.pid`
[root@zhu1 ~]# killall nginx
nginx 의 재 부팅
[root@zhu1 ~]# kill -HUP `cat /opt/nginx/logs/nginx.pid`
nginx 의 재 불 러 오기
[root@zhu1 ~]# /opt/nginx/sbin/nginx -s reload
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
사이트의 새 버전을 사용할 수 있을 때 사용자에게 알리고 페이지를 새로 고치라는 메시지를 표시합니다.사이트의 새 버전을 사용할 수 있을 때 사용자에게 알리고 페이지를 새로 고치라는 메시지를 표시합니다. 앱 배포를 완료하면 Lark 그룹 채팅에 배포 메시지를 보냅니다. version-rocket은 원격 서버의 버전 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.