国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Nginx > 正文

Linux下安裝Nginx1.9.3

2024-08-30 12:27:33
字體:
供稿:網(wǎng)友
linux下安裝Nginx1.9.3 Posted on 2015-08-02 14:02 CN.PRogrammer.Luxh 閱讀(...) 評論(...) 編輯 收藏

操作系統(tǒng):CentOS6.5 64bit

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 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 -zxv 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 http://www.openssl.org/source/openssl-1.0.2d.tar.gz
[root@iZ94jj63a3sZ src]# tar -zxvf openssl-1.0.2d.tar.gz 
[root@iZ94jj63a3sZ src]# cd openssl-1.0.2d

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.1d
[root@iZ94jj63a3sZ nginx-1.9.3]# make[root@iZ94jj63a3sZ nginx-1.9.3]# make install

7、設(shè)置開機自啟動

  在/etc/init.d/下建立nginx文件

[root@iZ94jj63a3sZ init.d]# vi nginx

  寫入以下內(nèi)容:

#!/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.confnginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confnginx_pid=/usr/local/nginx/logs/nginx.pidRETVAL=0prog="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 1fi   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" instart)        start        ;;stop)        stop        ;;reload)        reload        ;;restart)        stop        start        ;;status)        status $prog        RETVAL=$?        ;;*)        echo $"Usage: $prog {start|stop|restart|reload|status|help}"        exit 1esacexit $RETVAL

  賦予可執(zhí)行權(quán)限

[root@iZ94jj63a3sZ init.d]# chmod a+x /etc/init.d/nginx

  設(shè)置開機啟動

[root@iZ94jj63a3sZ init.d]# chkconfig --add /etc/init.d/nginx[root@iZ94jj63a3sZ init.d]# chkconfig nginx on

  啟動:

[root@iZ94jj63a3sZ lib64]# service nginx startStarting nginx:                                            [  OK  ][root@iZ94jj63a3sZ lib64]# 

8、啟動報錯處理

[root@iZ94jj63a3sZ init.d]# service nginx startStarting 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包含的動態(tài)函式庫

[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

  解決方法:

  進入/lib64目錄中手動鏈接下

[root@iZ94jj63a3sZ init.d]# cd /lib64/
[root@iZ94jj63a3sZ lib64]# ln -s libpcre.so.0.0.1 libpcre.so.1

 然后再啟動.

  


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 花垣县| 和静县| 沙河市| 白水县| 正宁县| 普陀区| 土默特左旗| 慈溪市| 孟津县| 六枝特区| 衡水市| 淮阳县| 襄城县| 靖宇县| 固镇县| 扶余县| 灵川县| 广灵县| 武功县| 自治县| 法库县| 遵义市| 乌什县| 滦平县| 巩义市| 阿勒泰市| 交口县| 铜山县| 宁化县| 古丈县| 龙口市| 翁源县| 湘阴县| 鄢陵县| 莎车县| 襄垣县| 中牟县| 芦山县| 沙坪坝区| 腾冲县| 湖南省|