nginx安装

今天安装nginx、在启动过程中出现了一个问题:

    首先把安装方法记录下:

        1.下载openssl-fips-2.0.5.tar.gz   地址:http://www.openssl.org/   (ssl需要用到的模块)

        2.下载 zlib-1.2.8.tar.gz        地址:http://www.zlib.net/     (gzip模块)

        3.下载pcre-8.33.tar.gz    地址: http://www.pcre.org/ (重写url需要用到的模块)

        4.下载 nginx-1.2.9.tar.gz    地址:http://nginx.org/en/download.html

 openssl-fips-2.0.5.tar.gz安装

[root@memcached1 nginx]# tar -zxvf openssl-fips-2.0.5.tar.gz 
[root@memcached1 nginx]# cd openssl-fips-2.0.5
[root@memcached1 nginx]# ./config
[root@memcached1 nginx]# make && make install
 zlib-1.2.8.tar.gz安装
[root@memcached1 nginx]# tar -zxvf zlib-1.2.8.tar.gz 
[root@memcached1 nginx]# cd zlib-1.2.8
[root@memcached1 nginx]# ./configure
[root@memcached1 nginx]# make && make install
  pcre-8.33.tar.gz安装


[root@memcached1 nginx]# tar -zxvf pcre-8.33.tar.gz
[root@memcached1 nginx]# cd pcre-8.33
[root@memcached1 nginx]# ./configure
[root@memcached1 nginx]# make && make install
nginx-1.2.9.tar.gz安装

[root@memcached1 nginx]# tar -zxvf nginx-1.2.9.tar.gz
[root@memcached1 nginx]# cd nginx-1.2.9
[root@memcached1 nginx]# ./configure --with-openssl=../openssl-fips-2.0.5 --with-zlib=../zlib-1.2.8 --with-pcre=../pcre-8.33
[root@memcached1 nginx]# make && make install
安装默认目录是:/usr/local/nginx

安装完之后直接启动nginx:/usr/local/nginx/sbin/nginx

启动的时候悲催了,出现了以下情况:


    /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory (看错误日志貌似是少了libpcre.so.1)

    1.使用命令查看包是哪一些:

[root@memcached1 nginx]# ldd $(which /usr/local/nginx/sbin/nginx)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003835400000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000383da00000)
        libpcre.so.1 => not found
        libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003101800000)
        libz.so.1 => /usr/local/lib/libz.so.1 (0x00002ba9457f8000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003834800000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003834400000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003835000000)
  尽然有一个包找不到,果断google之,发现这个是安装pcre的问题:

    进入lib目录下,按照网上的方法操作:ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1

  再进行启动nginx :/usr/local/nginx/sbin/nginx   还是报一样的错

  再次google   发现在64位系统上nginx读取的pcre文件为/lib64/libpcre.so.1文件

  最后使用  ln -s /usr/local/lib/libpcre.so.1 /lib64/  

  启动nginx即可(我在32位系统上试了,根据上面的方法安装是不会出现找不到libpcre.so.1这个文件的情况)


  特此记录下 

 

    


你可能感兴趣的:(nginx)