• 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的安装启动完成!############

  • 相关阅读:
    MongoDB创建数据库并授权
    nginx反向代理tomcat后,登录提示验证码错误,直接通过ip访问tomcat服务就可以
    Centos7 为es安装kibana
    ssh登录很慢解决方法
    nginx反向代理后端服务,访问时页面空白
    Error: rpmdb open failed
    centos7虚拟内存设置
    CentOS7利用docker安装MySQL5.7
    uniapp实现顶部tab选项卡
    top使用方法总结
  • 原文地址:https://www.cnblogs.com/cg-take/p/13099790.html
Copyright © 2020-2023  润新知