关于Nginx
款高性能,轻量级Web服务软件
-
<李>
稳定性高
李> <李>系统资源消耗低
李> <李>对HTTP并发连接的处理能力高
李> <李>单台物理服务器可支持30000 ~ 50000个并发请求李>Nginx编译安装
1。宿主机共享所需的工具包
2。虚拟机挂载共享目录
<代码> [root@localhost ~] # smbclient - l//192.168.100.50/进入SAMBA \ root的密码: 操作系统==(Windows 2019企业LTSC 17763)服务器(Windows 2019企业LTSC 6.3) Sharename类型的评论 - - - - - - - - - - - - - - - - - - - - - - - - IPC $ IPC远程IPC 共享磁盘 磁盘工具 用户的磁盘 连接192.168.100.50失败(错误NT_STATUS_RESOURCE_NAME_NOT_FOUND) NetBIOS通过TCP残疾,没有可用的工作组 (root@localhost ~) # mkdir/mnt/工具 root@localhost ~ #山。cifs//192.168.100.50/工具/mnt/工具/密码root@//192.168.100.50/工具: (root@localhost ~) # cd/mnt/工具/[root@localhost工具]# ls awstats-7.6.tar。广州extundelete-0.2.4.tar。bz2禁止获取。png jdk-8u191-windows-x64。zip LAMP-C7 picture.jpg cronolog el7.x86_64——1.6.2 - 14.。rpm提琴手。exe intellijideahahau2018。rar john-1.8.0.tar。广州LNMP [root@localhost工具]# 代码>
3。解压Nginx源码包
<代码> root@localhost工具# cd LNMP/[root@localhost LNMP] # ls Discuz_X3.4_SC_UTF8。邮政mysql-boost-5.7.20.tar。广州nginx-1.12.2.tar。广州php-7.1.20.tar.gz [root@localhost LNMP] #焦油zxvf nginx-1.12.2.tar。广州- c/opt/.......//省略解压过程代码>
4。安装编译Nginx所需环境包
<代码> [root@localhost LNMP] # yum - y安装gcc gcc-c + + pcre-devel zlib-devel ........//省略安装过程 [root@localhost LNMP] # 代码>
5。新建一个程序用户nginx
<代码> [root@localhost LNMP] # useradd - m - s/sbin/nologin nginx//- m,不创建家目录 [root@localhost LNMP] # id nginx//查看nginx用户 uid=1001 (nginx) gid=1001 (nginx)组=1001 (nginx) [root@localhost LNMP] # 代码>
6。配置Nginx服务
<代码> [root@localhost LNMP] # cd/opt/nginx-1.12.2/[root@localhost nginx-1.12.2] # ls 汽车改变CHANGES.ru conf配置contrib html许可人自述src # ./configure \ [root@localhost nginx-1.12.2) 比;——prefix=/usr/地方/nginx \//安装路径 比;——用户=nginx \//属主 比;——组=nginx \//属组 比;——with-http_stub_status_module//开启统计模块 ........//省略配置过程代码>
7。编译安装Nginx服务
<代码> [root@localhost nginx-1.12.2] #做,,制作安装 .........//省略编译过程 [root@localhost nginx-1.12.2] # 代码>
8。优化nginx命令执行路径
<代码> [root@localhost nginx-1.12.2] # cd/usr/local/nginx/[root@localhost nginx] # ls html的日志sbin相依 [root@localhost nginx] # cd sbin/[root@localhost sbin] # ls nginx [root@localhost sbin] # ln - s/usr/local/nginx/sbin/nginx/usr/local/sbin/[root@localhost sbin] # 代码>
9。开启nginx服务
<代码> [root@localhost sbin] # nginx - t//检查测试配置文件/usr/local/nginx/conf/nginx. nginx:配置文件配置语法好/usr/local/nginx/conf/nginx. nginx:配置文件配置测试是成功的 [root@localhost sbin] # nginx//开启服务 [root@localhost sbin] # netstat -ntap | grep 80//查看80端口 tcp 0 0 0.0.0.0:80 0.0.0.0: * 52709/nginx听:主人 [root@localhost sbin] # 代码>
10。关闭防火墙和增强性安全功能
<代码> [root@localhost sbin] # systemctl firewalld停止。服务//关闭防火墙 [root@localhost sbin] # setenforce 0//关闭增强性安全功能 [root@localhost sbin] # 代码>
11。安装elinks工具,测试nginx服务
<代码> [root@localhost sbin] # yum安装elinks - y//安装工具 .........//省略安装过程 (root@localhost sbin) # [root@localhost sbin] # elinks http://localhost/测试能否访问nginx服务代码>