#!/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/
实战案例linux一键部署wordpress项目shell脚本
最新推荐文章于 2024-08-22 10:14:23 发布