实验
一、LNMP架构解读
- LNMP平台就是Linux、Nginx、MySQL、PHP的组合架构,类似于apache的网页服务平台
- 主要用来处理静态页面,apache擅长处理动态页面
二、Nginx服务安装
[root@promote ~]# cd /opt
[root@promote opt]# ls
rh
[root@promote opt]# rz -E
rz waiting to receive.
[root@promote opt]# ls
Discuz_X3.4_SC_UTF8.zip ncurses-5.6.tar.gz php-7.1.10.tar.bz2
mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz rh
[root@promote opt]# yum -y install pcre-devel zlib-devel make gcc gcc-c++
[root@promote opt]# cd nginx-1.12.2/
[root@promote nginx-1.12.2]# useradd -M -s /sbin/nologin nginx
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module
[root@promote nginx-1.12.2]# make && make install
[root@promote nginx-1.12.2]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin
[root@promote nginx-1.12.2]# nginx -t
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@promote nginx-1.12.2]# vim /etc/init.d/nginx
#!/bin/bash
# chkconfig: - 99 20
# description:Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
start)
$PROG
;;
stop)
kill -s QUIT $(cat $PIDF)
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
[root@promote nginx-1.12.2]# chmod +x /etc/init.d/nginx
[root@promote nginx-1.12.2]