如何快速安装拉链

下面介绍一下Centos下安装Nginx的方法

Nginx的官网:***/ ,Nginx有三个版本:稳定版、开发版和历史稳定版。开发版更新快,包含最新的功能和bug修复,但同时也可能会出现新的bug。开发版一旦更新稳定下来,就会被加入稳定版分支,稳定版更新较慢,但bug较少,所以生产环境优先选择稳定版。

一、下载Nginx安装文件

目前最新稳定版:

***/download/nginx-1.16.0.tar.gz

,可以先下载好安装文件再通过ftp上传的CentOS上,也可以在CentOS上直接通过wget命令下载,这里我将文件下载到了/home/software文件夹下,如下:

[root@localhost software]# pwd
/home/software
[root@localhost software]# wget ***/download/nginx-1.10.1.tar.gz

二、解压安装文件

[root@songguoliang software]# tar -xzvf nginx-1.10.1.tar.gz

三、执行configure命令

通过cd命令进入Nginx解压文件目录,执行该目录下的configure命令,–prefix是打算将Nginx安装在哪个目录。在执行configure命令之前,确保安装了gcc、openssl-devel、pcre-devel和zlib-devel软件库(gzip模块需要 zlib 库,rewrite模块需要 pcre 库,ssl 功能需要openssl库),也可以直接执行configure命令,根据提示缺少的软件库安装,下面有缺少相应库报的错误信息和安装依赖库的方法。

为了方便,我们可以先安装一下必须的软件库。

[root@localhost software]# yum -y install gcc pcre-devel zlib-devel openssl-devel

出现类似下图信息或提示之前已经安装过等信息,说明已经安装好依赖库。如下:

如何快速安装拉链图1

这样事先安装好依赖库后,就不必看下面几个处理错误的步骤了,直接进行configure,如下:

[root@localhost software]# cd nginx-1.10.1
[root@localhost nginx-1.10.1]# pwd
/home/software/nginx-1.10.1
[root@localhost nginx-1.10.1]# ./configure –prefix=/usr/local/nginx

1、如果报下面错误,说明还没有安装gcc编译环境,可以通过yum在线安装功能安装gcc,重新执行configure命令。

[root@localhost nginx-1.10.1]# ./configure –prefix=/usr/local/nginx
checking for OS
+ Linux 2.6.32-431.el6.x86_64 x86_64
checking for C compiler … not found

./configure: error: C compiler cc is not found

在线安装gcc:

[root@localhost nginx-1.10.1]# yum install gcc

2、如果报下面的错误,说明没有安装pcre-devel库,通过yum在线安装pcre后,重新执行configure命令。

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre=<path> option.

在线安装pcre-devel库:

[root@localhost nginx-1.10.1]# yum -y install pcre-devel

-y参数表示使用yum在线安装时,如果需要用户输入Y/N时自动输入Y。

3、如果报下面的错误,说明没有安装zlib库,安装zlib库后重新执行configure命令。

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using –with-zlib=<path> option.

在线安装zlib库:

[root@localhost nginx-1.10.1]# yum -y install zlib-devel

4、如果报以下错误,说明没有安装OpenSSL库,安装OpenSSL库后重新执行configure命令。

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using –with-openssl=<path> option.

在线安装openssl库:

[root@localhost nginx-1.10.1]# yum install openssl-devel

执行configure命令成功后,显示如下信息:

checking for zlib library … found
creating objs/Makefile

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”
nginx binary file: “/usr/local/nginx/sbin/nginx”
nginx modules path: “/usr/local/nginx/modules”
nginx configuration prefix: “/usr/local/nginx/conf”
nginx configuration file: “/usr/local/nginx/conf/nginx.conf”
nginx pid file: “/usr/local/nginx/logs/nginx.pid”
nginx error log file: “/usr/local/nginx/logs/error.log”
nginx http access log file: “/usr/local/nginx/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”

四、执行make命令

[root@localhost nginx-1.10.1]# make

五、执行make install命令

[root@localhost nginx-1.10.1]# make install

步骤四和步骤五可以合并执行如下命令,连接符 && 代表前面一个命令如果执行成功则继续执行后面的命令,如果前面命令执行失败则不再执行后面的命令。而 || 表示如果前面的命令执行成功则不执行后面的命令,如果前面的命令执行失败则继续执行后面的命令

[root@localhost nginx-1.10.1]# make && make install

六、启动Nginx服务

[root@localhost nginx-1.10.1]# cd /usr/local/nginx/
[root@localhost nginx]# ll
总用量 16
drwxr-xr-x. 2 root root 4096 10月 1 23:35 conf
drwxr-xr-x. 2 root root 4096 10月 1 23:35 html
drwxr-xr-x. 2 root root 4096 10月 1 23:35 logs
drwxr-xr-x. 2 root root 4096 10月 1 23:35 sbin
[root@songguoliang nginx]# ./sbin/nginx

通过浏览器访问Nginx,显示如下welcome to nginx!页面便表示安装成功:

如何快速安装拉链图2

nginx启动、重启、重新加载配置文件和平滑升级

nginx启动、重启、重新加载配置文件和平滑升级可以参考我博客

***/gnail_oug/article/details/52754491

原创文章,作者:小编,如若转载,请注明出处:http://www.ranqigaiguan.com/yhtg/10819.html

(0)
上一篇 48分钟前
下一篇 1分钟前

相关推荐

  • 咸菜做的太咸了怎么补救

    1 泡菜太咸,可能是因为放入坛子腌制的菜的量太少了,导致盐分都吸入到少量的菜里去了 2 可以在坛子里多放些其他的蔬菜,让盐分吸附到其他蔬菜上去,就没那么咸了。 3 泡菜太咸了,吃起…

    用户投稿 2023年 2月 12日
  • 冬天做腐乳几天不长毛

    我老妈经常自己做豆腐乳的,老人家的经验是冬天做腐乳要等它长毛,大约15天左右。 外面的豆腐乳总没有自家的做豆腐乳好,自己做的更卫生安全放心,味道也更美。 做豆腐乳要经过三大步骤,分…

    2023年 2月 12日
  • 蟾宫折桂是什么动物生肖,蟾宫折桂比喻什么动物

    蟾宫折桂不是一种动物。 “蟾宫折桂”是一把书刀,古代读书人用来修改书简、裁剪纸张的刀。 古人常把书刀作为成人礼,赠送给子侄,表达对后辈的殷切希望。 『蟾宫折桂』 书刀的历史,可以追…

    2023年 1月 29日
  • 饭店厨房下水道堵了怎么办,饭店下水道堵了怎么快速疏通

    ● 先找病因再通管 治堵服疏靠预防 ● … 厨房下水管堵塞,就像打不死的小强,一直都在发生,却没法断根。但奇怪的是:设计阶段,很少有业主专门提要求,给与重视;装修阶段,一切又都服从…

    2022年 12月 31日
  • 科举制度是哪个朝代最先发明的,科举制度起源于哪个朝代哪个皇帝

    科举制度,是中国封建社会选拔官吏的考试制度,曾被历朝统治者视为抡才大典而倍受重视。它的特点是:开科取士、自由报考,以成绩优劣来决定取舍人才。 科举制度究竟起源于何时,至今众说纷纭,…

    2023年 1月 9日
  • 本命年要穿红色内衣裤吗

    #丁酉新春#生肖,或属相,是中国及东亚地区的一些民族用来代表年份的十二种动物,统称为十二生肖,即鼠、牛、虎、兔、龙、蛇、马、羊、猴、鸡、狗、猪,它们依次与十二地支(子、丑、寅、卯、…

    用户投稿 2022年 11月 20日
  • 一般和尚鹦鹉多大能开口说话(一年的和尚鹦鹉还能学会说话吗)

    哈喽,大家好,我是被鹦鹉耽误的厨子,,和尚鹦鹉英文名称:Monk Parakeet 长尾小鹦鹉 Monk 意为:修道士,僧侣。僧侣鹦鹉,早年间僧侣与和尚叫法一样。养鸟圈子觉得和尚更…

    2023年 3月 2日
  • 为什么有人觉得猫科动物不是熊科动物的对手呢

    猫科动物有大有小,最大的当属虎狮,熊科动物也有大有小,最大的当属科迪亚克棕熊,北极熊,堪察加棕熊,阿拉斯加棕熊,乌苏里江棕熊。 老虎最大的是西伯利亚虎,也作东北虎,有森林之王和百兽…

    1天前
  • 生锈的光绪元宝值钱吗(光绪元宝有那么值钱嘛)

    前言 光绪元宝也是现在银元收藏类的热门品种,主要是龙的图案深受我们国家人民的喜爱,再加上光绪元宝的种类也是比较多,收藏起来也是比较有意思,当然其中也有高端的品种,所以不管是有钱的还…

    2023年 1月 6日
  • 老虎和狮子谁厉害

    不同的老虎亚种和不同的狮子亚种之间的体型战斗力都有很大的交集,大家普遍认为,最大的老虎是东北虎,所以最强的也是东北虎,这个观点是错误的,野生东北虎的体重,是肯定不如野生的孟加拉虎,…

    2023年 1月 13日