【系统部署知识汇总】第3章—— nginx

Nginx介绍

• Nginx(“engine x”)是⼀款是由俄罗斯的程序设计师Igor Sysoev所开发⾼性能的 Web和 反向代理 服务器,也是⼀个 IMAP/POP3/SMTP 代理服务器。
• 轻量级的web服务器
• 延伸版本tengine(淘宝)、openresrt(章亦春)等 • http://nginx.org 官⽹
• http://www.nginx.cn/doc/index.html 中⽂⽂档

声明

• 实验机器: Vmware 虚拟机 2核4G
• ⽹卡:桥接
• 系统:centos7.5
• 防⽕墙:关闭
• Selinux:关闭
• ⽹段:192.168.10.0/24
主机名 IP ⻆⾊
Master.ayitula.com 192.168.10.40 主分发器
Backup.ayitula.com 192.168.10.41 备分发器
Web01.ayitula.com 192.168.10.42 数据服务器1
Web02.ayitula.com 192.168.10.43 数据服务器2

Nginx 安装

参考链接:

 https://www.baidu.com/link?url=o-L0R9ODFIdM2952yYzhP0CG3ZSNCeVyFYPGS_54e1ZLDvafjzLIbkN2DPc_SbBY0MnBNMB70u4mwkuCe0Z8_a&wd=&eqid=99b296fa00023636000000065e219f59

Nginx获得

• 官⽹源码包
• wget http://nginx.org/download/nginx-1.15.5.tar.gz -P /usr/src

Nginx安装

• 源码安装三部曲
 配置--à编译--à安装
 
• 配置 configure
 --prefix=path 安装路径
 --help 配置参数
 
• 编译
make

• 安装
make install

相关⽂件

• 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"

启动⽅法

• /usr/local/nginx/sbin/nginx
 

验证⽅法

netstat –ntpl
lsof -i :80

Nginx验证测试

在这里插入图片描述

添加全局变量

第一步:创建一个nginx的shell脚本并添加内容

 # vim /etc/profile.d/nginx.sh
 
添加内容:export PATH=/usr/local/nginx/sbin:$PATH
第二步:在全局环境中生效变量
 # exec bash /etc/profile.d/nginx.sh
 # source /etc/profile.d/nginx.sh
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值