一、概述
Nginx是一款轻量级的web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好,中国大陆使用nginx的网站有: 百度、京东新浪、网易、腾讯、淘宝等
Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler,ru站点(俄文: Pamnep)开发的,第一个公开版本0.1.0发布于2004年10月4日。
官网: https://nginx.org/
二、安装
1.版本区别
常用版本分为四大阵营
Nginx
开源版
http://nginx.org/
Nginx plus
商业版
https://www.nginx.com
openresty
http://openresty.org/cn/
Tengine
http://tengine.taobao.org/
2.安装过程
2.1 、安装依赖包
yum -y install gcc pcre-devel zlb-devel openssl openssl-devel
2.2、下载Nginx安装包
wget https://nginx.org/download/nginx-1.16.1.tar.gz提示找不到命令的话使用yum install wget
下载wget
2.3、解压
tar -zxvf nginx-1.16..tar.gz
2.4、进入到文件夹
cd nginx-1.16.1
2.5、编译
./configure -- prefix=/usr/local/nginx
2.6、安装
makemake install
PS:如果出现警告或报错
提示
checking for OS+ Linux 3.10.0-693.el7.x86_64 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found
安装
gcc
yum install - y gcc
提示:
./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.
安装
perl
库
yum install -