cat /etc/issue* /etc/*release 2>/dev/null|grep -qE "debian|ubuntu|Ubuntu"&&OS="Debian" cat /etc/issue* /etc/*release 2>/dev/null|grep -qE "release|centos|CentOS"&&OS="RedHat" id -u nobody &>/dev/null||useradd nobody -r -s /bin/false groupadd -f nobody &>/dev/null if [ "$OS" = "RedHat" ] then yum -y install yum-utils yum -y install epel-release yum -y install vim wget bzip2 unzip rsync yum -y localinstall https://mirror.webtatic.com/yum/el7/webtatic-release.rpm wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/MariaDB.repo -O /etc/yum.repos.d/MariaDB.repo yum -y install MariaDB-server MariaDB-client yum -y install php72w yum -y install php72w-cli php72w-common php72w-devel php72w-mysql php72w-fpm yum -y install php72w-gd php72w-imap php72w-ldap php72w-odbc php72w-pear php72w-xml php72w-xmlrpc php72w-mbstring php72w-pdo systemctl start mariadb [ -d /etc/rc.d ]||mkdir -p /etc/rc.d [ -d /etc/php-fpm.d ]||mkdir -p /etc/php-fpm.d wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/RedHat-php.conf -O /etc/php-fpm.d/www.conf wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/wordpress-rc.local.conf -O /etc/rc.d/rc.local wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/mysql-server.cnf -O /etc/my.cnf.d/server.cnf chmod 755 /etc/rc.d/rc.local mysql <<- EOF set password for root@localhost=password('io'); create database wordpress; EOF systemctl restart mariadb systemctl restart php-fpm systemctl enable mariadb systemctl enable php-fpm fi if [ "$OS" = "Debian" ] then apt-get -y update apt-get -y install vim wget bzip2 unzip rsync apt-get -y remove apache2 apt-get -y install php7.[0-9] apt-get -y install php7.[0-9]-mysql php7.[0-9]-fpm apt-get -y install php7.[0-9]-gd php7.[0-9]-mbstring php7.[0-9]-xmlrpc apt-get -y install mysql-server --allow-unauthenticated mysql -pio<<- EOF create database wordpress; EOF wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/Debian-php.conf -O `find /etc/php/ -name www.conf` wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/wordpress-rc.local.conf -O /etc/rc.local chmod 755 /etc/rc.local systemctl restart mysql /etc/init.d/php*-fpm restart fi [ -d /opt/sys ]||mkdir -p /opt/sys [ -d /var/log/php-fpm ]||mkdir -p /var/log/php-fpm [ -d /var/log/mariadb ]||mkdir -p /var/log/mariadb wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/openresty-$OS.tgz -O -|tar xzf - -C /opt wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/wordpress-nginx.conf -O /opt/openresty/nginx/conf/nginx.conf wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/wordpress.tgz -O -|tar xzf - -C /opt wget -t 3 https://xabc-1251125987.cos.ap-nanjing.myqcloud.com/files/wordpress-start.sh -O /opt/sys/wordpress-start.sh chown -R nobody.nobody /opt/openresty chown -R nobody.nobody /opt/wordpress chown root.nobody /opt/openresty/nginx/sbin/nginx chmod +xs /opt/openresty/nginx/sbin/nginx chmod 700 /opt/sys/wordpress-start.sh pgrep nginx||/opt/openresty/nginx/sbin/nginx