Nginx安装与导学

本文详细介绍了Nginx的安装过程,包括安装依赖、下载、解压、编译和安装步骤。同时,讲解了Nginx的常用命令,如查看版本和配置文件正确性的方法。此外,还阐述了Nginx的目录结构和配置文件结构,以及如何通过配置实现静态资源部署、反向代理和负载均衡,是运维人员入门Nginx的实用教程。
摘要由CSDN通过智能技术生成

一、概述

        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、安装

make
make install
PS:如果出现警告或报错
提示
checking for OS
+ Linux 3.10.0-693.el7.x86_64 x86_64
checking 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_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.
安装 perl
yum install -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值