一键部署LNMP(源码安装nginx,yum安装m,p)

shell脚本编写:

L:基于linux系统安装

N:部署nginx,提供web服务(提供页面)

M:部署mariadb数据库服务(存储用户数据)

P:部署php服务(实现动态网页的翻译)

环境准备:

	准备一个nginx的源码包:nginx-1.12.2.tar.gz
		备注:我下载的nginx-1.12.2.tar.gz在lnmp_soft.tar.gz包里
	搭建yum源仓库
#!/bin/bash
path="/usr/local/nginx/conf/nginx.conf"
yum -y install gcc pcre-devel openssl-devel
cd
tar -xf lnmp_soft.tar.gz
cd lnmp_soft
tar -xf nginx-1.12.2.tar.gz
cd nginx-1.12.2
./configure --with-http_ssl_module
make
make install

yum -y install mariadb mariadb-server mariadb-devel
yum -y install php php-fpm php-mysql

sed -i '65,71s/#//' $path
sed -i '/SCRIPT_FILENAME/d' $path
sed -i 's/fastcgi_params/fastcgi.conf/' $path

systemctl stop httpd

systemctl restart mariadb
systemctl restart php-fpm
ln -s /usr/local/nginx/sbin/nginx /sbin/
/usr/local/nginx/sbin/nginx

systemctl enable mariadb
systemctl enable php-fpm

你可能感兴趣的:(IT专栏,云计算)