Linux 에 Nginx 1.9.3 설치
Nginx: 1.9.3
1. Nginx 다운로드
[root@iZ94jj63a3sZ softs]# wget http://nginx.org/download/nginx-1.9.3.tar.gz
2. 의존 라 이브 러 리 설치
[root@iZ94jj63a3sZ softs]# yum -y install gcc automake autoconf libtool make libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed
[root@iZ94jj63a3sZ softs]# yum install gcc gcc-c++
3. pcre 설치, rewrite 재 작성 에 사용
[root@iZ94jj63a3sZ softs]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
pcre 를 / usr / local / src 에 설치 합 니 다.
[root@iZ94jj63a3sZ softs]# cd /usr/local/src/
[root@iZ94jj63a3sZ src]# tar -zxvf pcre-8.37.tar.gz
[root@iZ94jj63a3sZ src]# cd pcre-8.37
[root@iZ94jj63a3sZ pcre-8.37]# ./configure
[root@iZ94jj63a3sZ pcre-8.37]# make
[root@iZ94jj63a3sZ pcre-8.37]# make install
4 、 zlib 설치, gzip 압축 에 사용
/ usr / local / src 에 설치
[root@iZ94jj63a3sZ src]# wget http://zlib.net/zlib-1.2.8.tar.gz
[root@iZ94jj63a3sZ src]# tar -zxvf zlib-1.2.8.tar.gz
[root@iZ94jj63a3sZ src]# cd zlib-1.2.8
[root@iZ94jj63a3sZ zlib-1.2.8]# ./configure
[root@iZ94jj63a3sZ zlib-1.2.8]# make
[root@iZ94jj63a3sZ zlib-1.2.8]# make install
5. openssl 설치, ssl 에 사용
/ usr / local / src 에 설치 하여 압축 을 풀 면 됩 니 다.
[root@iZ94jj63a3sZ src]# wget ftp://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2d.tar.gz
[root@iZ94jj63a3sZ src]# tar -zxvf openssl-1.0.2d.tar.gz
6. Nginx 설치
/ usr / local / nginx 에 설치
[root@iZ94jj63a3sZ softs]# cd /usr/local
[root@iZ94jj63a3sZ local]# pwd
/usr/local
[root@iZ94jj63a3sZ local]#
[root@iZ94jj63a3sZ local]# cd nginx-1.9.3
[root@iZ94jj63a3sZ nginx-1.9.3]# ./configure \
--prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-pcre=/usr/local/src/pcre-8.37 \
--with-zlib=/usr/local/src/zlib-1.2.8 \
--with-openssl=/usr/local/src/openssl-1.0.2d
[root@iZ94jj63a3sZ nginx-1.9.3]# make
[root@iZ94jj63a3sZ nginx-1.9.3]# make install
7. 자동 시작 설정
/ etc / init. d / 에 nginx 파일 만 들 기
[root@iZ94jj63a3sZ init.d]# vi nginx
다음 내용 을 기록 합 니 다:
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
실행 가능 한 권한 부여
[root@iZ94jj63a3sZ init.d]# chmod a+x /etc/init.d/nginx
부팅 설정
[root@iZ94jj63a3sZ init.d]# chkconfig --add /etc/init.d/nginx
[root@iZ94jj63a3sZ init.d]# chkconfig nginx on
시작:
[root@iZ94jj63a3sZ lib64]# service nginx start
Starting nginx: [ OK ]
[root@iZ94jj63a3sZ lib64]#
8. 오류 처리 시작
[root@iZ94jj63a3sZ init.d]# service nginx start
Starting nginx: /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[FAILED]
ldd 를 사용 하여 nginx 에 포 함 된 동적 편지 라 이브 러 리 를 봅 니 다.
[root@iZ94jj63a3sZ src]# ldd $(which /usr/local/nginx/sbin/nginx)
linux-vdso.so.1 => (0x00007fff89fff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003978400000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000397b800000)
libpcre.so.1 => not found
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007ffd9a115000)
libz.so.1 => /lib64/libz.so.1 (0x0000003977c00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003978000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003977800000)
libfreebl3.so => /lib64/libfreebl3.so (0x000000397ac00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003978800000)
[root@iZ94jj63a3sZ src]# cd /
볼 수 있다 libpcre.so.1 => not found
해결 방법:
/ lib 64 디 렉 터 리 에 수 동 으로 연결 하기
[root@iZ94jj63a3sZ init.d]# cd /lib64/
[root@iZ94jj63a3sZ lib64]# ln -s libpcre.so.0.0.1 libpcre.so.1
그리고 시동 걸 어.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.