0
点赞
收藏
分享

微信扫一扫

【系统部署知识汇总】第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 安装

参考链接:

=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验证测试

【系统部署知识汇总】第3章—— 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 条评论