zoukankan      html  css  js  c++  java
  • linux服务下安装nginx Ubuntu版本:16.0 gcc版本:.5.4

    linux服务下安装nginx  系统版本Ubuntu 18.04.4

    一、下载nginx包(已存入我的百度网盘)

    链接:https://pan.baidu.com/s/19e4FbscqZXNrPPnpDwaIDQ
    提取码:4mj9

    或者到官网下载:http://nginx.org/en/download.html


    二、将上面的包上传到服务器(我习惯直接传到root目录下)

    三、依次安装

    • openssl-fips-2.0.12.tar.gz,
    • zlib-1.2.8.tar.gz,
    • pcre-8.42.tar.gz,
    • nginx-1.10.1.tar.gz
    1. 安装openssl-fips-2.0.12.tar.gz
      [root@localhost mrms]# tar -zxvf openssl-fips-2.0.12.tar.gz 
      [root@localhost mrms]# cd openssl-fips-2.0.12
      [root@localhost openssl-fips-2.0.12]# ./config 
      [root@localhost openssl-fips-2.0.12]# make
      [root@localhost openssl-fips-2.0.12]# make install
      出错:libtool: warning: relinking 'libpcrecpp.la'
      解决办法:./configure --disable-shared --with-pic
      之后执行:make 没有错误

        

    2. 安装zlib-1.2.8.tar.gz
      [root@localhost mrms]# tar -zxvf zlib-1.2.8.tar.gz
      [root@localhost mrms]# cd zlib-1.2.8
      [root@localhost zlib-1.2.8]# ./configure 
      [root@localhost zlib-1.2.8]# make
      [root@localhost zlib-1.2.8]# make install
      

        

    3. 安装pcre-8.38.tar.gz
      [root@localhost mrms]# tar -zxvf pcre-8.42.tar.gz
      [root@localhost mrms]# cd pcre-8.42
      [root@localhost pcre-8.21]# ./configure 
      [root@localhost pcre-8.21]# make
      [root@localhost pcre-8.21]# make install
      出错:libtool: warning: relinking 'libpcrecpp.la'
      解决办法:./configure --disable-shared --with-pic
      之后执行:make 没有错误

        

    4. 安装 nginx-1.10.1.tar.gz
      [root@localhost mrms]# tar -zxvf nginx-1.10.1.tar.gz 
      [root@localhost mrms]# cd nginx-1.10.1
      [root@localhost nginx-1.10.1]# ./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.12
      [root@localhost nginx-1.10.1]# make
      [root@localhost nginx-1.10.1]# make install

      如果:make出错:src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
      h ^= data[2] << 16;
      ~~^~~~~~~~~~~~~~~~
      解决办法:进入到/root/nginpage/nginx-1.10.1/objs/目录下(解压的目录)
      打开编辑文件Makefile,找到有一下内容的这行:
      CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
      把这行内容中的 “-Werror”去掉

      -Werror: gcc将所有的警告当成错误进行处理

      ##########至此Nginx的安装完成!############

     
    四、检测是否安装成功

    ps -ef | grep xxx
    [root@localhost nginx-1.2.6]# cd  /usr/local/nginx/sbin
    [root@localhost sbin]# ./nginx -t

    出现如下所示提示,表示安装成功
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful  

    如果报错提示:./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    执行命令:ldconfig -v|grep pcre

     启动nginx:

    [root@localhost sbin]# ./nginx

    查看端口

    [root@localhost sbin]# netstat -ntlp

    结果如下

     ##########至此Nginx的安装启动完成!############

  • 相关阅读:
    【洛谷P2927 [USACO08DEC]拼图游戏Jigsaw Puzzles】深搜
    【洛谷1219】 八皇后 (搜索)
    【Uva 12558】 Egyptian Fractions (HARD version) (迭代加深搜,IDA*)
    【转】DCX (数独-八皇后问题)
    【2016 11 14】 总结
    【HDU 3038】 How Many Answers Are Wrong (带权并查集)
    【POJ1182】 食物链 (带权并查集)
    【20161111双11模拟赛】总结
    【HDU 5381】 The sum of gcd (子区间的xx和,离线)
    【HDU 5233】Tree chain problem (树形DP+树剖+线段树|树状数组)最大权不相交树链集
  • 原文地址:https://www.cnblogs.com/cg-take/p/13099790.html
Copyright © 2011-2022 走看看