• 【原创】Linux下的ngix服务器安装步骤


    1.首先下载ngix的源码linux版本【1.5.8版本】

    http://nginx.org/en/download.html


    2.下载PCRE library,是安装ngix的必备包之一

    [root@localhost ngix]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F&ts=1389689100&use_mirror=jaist
    ---------------------------------
    [root@localhost pcre-8.34]# unzip pcre-8.34.zip
    [root@localhost pcre-8.34]# cd pcre-8.34
    [root@localhost pcre-8.34]# ./configure
    .....shenglue
    [root@localhost pcre-8.34]# make
    [root@localhost pcre-8.34]# make install
    make[1]: Entering directory `/home/ngix/pcre-8.34'
    make[2]: Entering directory `/home/ngix/pcre-8.34'
     /bin/mkdir -p '/usr/local/lib'
     /bin/sh ./libtool   --mode=install /usr/bin/install -c   libpcre.la libpcreposix.la libpcrecpp.la '/usr/local/lib'


    3.解压ngix,首先检测检测

    [root@localhost nginx-1.5.8]# ./configure 【--prefix=/ngix --with-pcre=/usr/local/pcre】
    Configuration summary
      + using system PCRE library
      + OpenSSL library is not used
      + using builtin md5 code
      + sha1 library is not found
      + using system zlib library
    
      nginx path prefix: "/usr/local"
      nginx binary file: "/usr/local/sbin/nginx"
      nginx configuration prefix: "/usr/local/conf"
      nginx configuration file: "/usr/local/conf/nginx.conf"
      nginx pid file: "/usr/local/logs/nginx.pid"
      nginx error log file: "/usr/local/logs/error.log"
      nginx http access log file: "/usr/local/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"

    通过后编译、安装:

    [root@localhost nginx-1.5.8]# make
    [root@localhost nginx-1.5.8]# make install

    4.查看是否安装成功

    [root@localhost sbin]# ./nginx -t 
    nginx: the configuration file /usr/local/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/conf/nginx.conf test is successful

    有时会报错:

    [root@localhost sbin]# ./nginx -t 
    ./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

    这样的话查看一下详细信息:

    [root@localhost conf]# ldd $(which /usr/local/sbin/nginx)
    linux-gate.so.1 => (0x0071b000)
    libpthread.so.0 => /lib/libpthread.so.0 (0×00498000)
    libcrypt.so.1 => /lib/libcrypt.so.1 (0×00986000)
    libpcre.so.1 => not found
    libcrypto.so.6 => /lib/libcrypto.so.6 (0×00196000)
    libz.so.1 => /lib/libz.so.1 (0×00610000)
    libc.so.6 => /lib/libc.so.6 (0x002d7000)
    /lib/ld-linux.so.2 (0x006a8000)
    libdl.so.2 => /lib/libdl.so.2 (0x008c3000)

    链接文件导致,重新链接一下:

    [root@localhost pcre]# cd /lib
    [root@localhost lib]# ln -s libpcre.so.0.0.1 libpcre.so.1
    [root@localhost lib]# 
    [root@localhost lib]# 

    再次检查:

    [root@localhost sbin]# ./nginx -t 
    nginx: the configuration file /usr/local/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/conf/nginx.conf test is successful
    [root@localhost sbin]# 

    启动并访问浏览器http://172.20.70.251

    Welcome to nginx!
    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
    
    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.
    
    Thank you for using nginx.
  • 相关阅读:
    10. 正则表达式匹配(动态规划)
    8. 字符串转换整数 (atoi)
    5. 最长回文子串
    4. 寻找两个正序数组的中位数
    1109. 航班预订统计
    计算机网络面试整理
    HTTP 响应 代码
    Tomcat 安装 2019.1.20
    ubuntu 编译 jdk (三)
    ubuntu 编译 jdk (二)
  • 原文地址:https://www.cnblogs.com/zhangxsh/p/3519544.html
Copyright © 2020-2023  润新知