Nginx
一款高性能、轻量级web服务软件
(1)稳定性高
(2)系统资源消耗低
(3)对HTTP并发连接的处理能力高
单台物理服务器可支持30000~50000个并发请求
Nginx编译安装
将安装文件包挂载到虚拟机上并查看
[root@localhost ~]
Password for root@//192.168.100.3/LAMP8:
[root@localhost ~]
[root@localhost mnt]
Discuz_X3.4_SC_UTF8.zip nginx-1.12.0.tar.gz php-7.1.10.tar.bz2
mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
[root@localhost mnt]
将Nginx安装包解压到/opt/目录下
[root@localhost mnt]
安装支持软件
[root@localhost opt]
创建运行用户、组
[root@localhost opt]
编译安装Nginx
[root@localhost opt]
[root@localhost nginx-1.12.2]
auto CHANGES.ru configure html man src
CHANGES conf contrib LICENSE README
[root@localhost nginx-1.12.2]
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module
[root@localhost nginx-1.12.2]
nginx命令执行路劲优化
[root@localhost nginx-1.12.2]
[root@localhost nginx-1.12.2]
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost nginx-1.12.2]
[root@localhost nginx-1.12.2]
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 20716/nginx: master
关闭防火墙和安全功能
[root@localhost nginx-1.12.2]
[root@localhost nginx-1.12.2]
安装测试包,查看服务是否正常运行
[root@localhost nginx-1.12.2]
[root@localhost nginx-1.12.2]
通过浏览器查看,输入自己的IP地址
制作管理脚本
[root@localhost logs]
[root@localhost init.d]
functions netconsole network README
[root@localhost init.d]
PROG="/usr/local/nginx/sbin/nginx"
PIOF="/usr/local/nginx/sbin/nginx"
case "$1" in
start)
$PROG
;;
stop)
kill -s QUIT $(cat $PIOF)
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIOF)
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
[root@localhost init.d]
[root@localhost init.d]
然后我们的服务就可以通过service来控制服务的启动
修改nginx.conf配置文件
[root@localhost init.d]
[root@localhost nginx]
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@localhost nginx]
[root@localhost conf]
fastcgi.conf koi-win scgi_params
fastcgi.conf.default mime.types scgi_params.default
fastcgi_params mime.types.default uwsgi_params
fastcgi_params.default nginx.conf uwsgi_params.default
koi-utf nginx.conf.default win-utf
[root@localhost conf]
#### 安装DNS服务,并配置DNS服务
[root@localhost conf]
配置主配置文件
配置区域配置文件
配置区域数据配置文件
[root@localhost conf]
[root@localhost named]
[root@localhost named]
开启DNS服务
[root@localhost named]# systemctl start named
开启一台win10,测试