ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

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

2020-06-12 15:53:22  阅读:376  来源: 互联网

标签:pcre 18.04 tar gz nginx Ubuntu root localhost


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
    

      

  2. 安装zlib-1.2.8.tar.gz
    [root@localhost mrms]# 	
    [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;
    ~~^~~~~~~~~~~~~~~~
    解决办法:进入到nginx-1.6.3目录下(解压的目录)
    找到当前目录下找到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的安装启动完成!############

 

标签:pcre,18.04,tar,gz,nginx,Ubuntu,root,localhost
来源: https://www.cnblogs.com/cg-take/p/13099790.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有