安装依赖包

yum -y yum -y install gcc openssl-devel pcre-devel zlib-devel

#创建用户没有可交互的shell

useradd -s /sbin/nologin nginx

#源码安装nginX

tar xf /lnmp_soft.tar.gz

cd lnmp_soft/

tar xf nginx-1.12.2.tar.gz

cd nginx-1.12.2/

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module

make && make install

#安装数据库的包

yum -y install mariadb mariadb-server mariadb-devel

yum -y install php php-mysql

yum -y install lnmp_soft/php-fpm-5.4.16-42.el7.x86_64.rpm

#启动相关服务

systemctl start mariadb

systemctl enable mariad

systemctl start php-fpm

systemctl enable php-fpm

#关闭httpd服务,以免占用80端口

systemctl stop httpd

#启动nginX服务

ln -s /usr/local/nginx/sbin/nginx /sbin/

nginx

ss -antpu | grep nginx