实战案例linux一键部署wordpress项目shell脚本

#!/bin/bash
#变量
#mysql密码
pass=Test@123456
#构建基础环境
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#关闭linux
setenforce 0
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
yum install -y epel-release
yum -y install bash-completion vim wget
#安装LNMP环境
rpm -q nginx
if [ $? -ne 0 ]
then
yum install -y epel-release 
yum install -y nginx php-fpm php-mysql php-gd
fi
systemctl start php-fpm
systemctl enable php-fpm
systemctl start nginx
systemctl enable nginx
grep php /etc/nginx/nginx.conf
if [ $? -ne 0 ]
then
sed -ri '/^[ /t]+server \{/a location / {\
index index.php;\
}\
location ~ \\.php$ {\
root /usr/share/nginx/html;\
fastcgi_pass 127.0.0.1:9000;\
fastcgi_index index.php;\
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\
include fastcgi_params;\
}' /etc/nginx/nginx.conf 
fi
systemctl restart nginx
#Mysql
yum install -y mariadb-server mariadb
systemctl start mariadb
systemctl enable mariadb
mysqladmin password $pass
mysql -p$pass -e 'create database wordpress;'
mysql -p$pass -e 'grant all on wordpress.* to "boke"@"%" identified by "Test@123456"'

wget https://cn.wordpress.org/wordpress-4.9.1-zh_CN.zip
unzip wordpress-4.9.1-zh_CN.zip
rm -rf /usr/share/nginx/html/*
cp -rf  /root/wordpress/* /usr/share/nginx/html
chown -R nginx.nginx /usr/share/nginx/html/*
chmod 777 /usr/share/nginx/html/

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值