CentOs lnmp环境搭建wordpress博客

前端之家收集整理的这篇文章主要介绍了CentOs lnmp环境搭建wordpress博客前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

LNMP代表的就是:Linux系统下Nginx+MysqL+PHP这种网站服务器架构。

Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统。

Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器。

MysqL是一个小型关系型数据库管理系统

PHP是一种在服务器端执行的嵌入HTML文档的脚本语言

这四种软件均为免费开源软件,组合到一起,成为一个免费、高效、扩展性强的网站服务系统。

#!/bin/bash
a='yuminstall-y'
b='yumgroupinstall-y'
yum_gpk(){
cd/usr/local/src
$awgetlibmcrypt-develbzip2-develgccpcre-developenssl-develPHP-mcryptlibmcryptlibxml2-devellibjpeg-devellibpng-develfreetype-devel
$b"DevelopmentTools"
wgethttp://cn2.PHP.net/distributions/PHP-5.5.38.tar.gz
wgethttp://Nginx.org/download/Nginx-1.12.0.tar.gz

}


Nginx_install(){
cd/usr/local/src
useraddNginx
tarzxvfNginx-1.12.0.tar.gz
cdNginx-1.12.0/
./configure--prefix=/usr/local/Nginx--user=Nginx--group=Nginx--with-http_ssl_module--with-http_flv_module--with-http_stub_status_module--with-http_gzip_static_module--with-pcre

make&&makeinstall
cd/usr/local/Nginx/sbin/
./Nginx
netstat-ntlp|grepNginx

}

Nginx_check(){
prog="Nginxd"
Nginx_bin="/usr/local/Nginx/sbin/Nginx"
if[-x${Nginx_bin}];then
	echo"Nginxisinstalld"
else
	echo-n"Nginxisnotinstalled"
	exit5
fi

}

PHP_install(){
cd/usr/local/src
tarzxvfPHP-5.5.38.tar.gz

cdPHP-5.5.38/
./configure--prefix=/usr/local/PHP--with-MysqL=MysqLnd--with-pdo-MysqL=MysqLnd--with-MysqLi=MysqLnd--with-openssl--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-mcrypt--with-bz2--enable-fpm--with-gd
make&&makeinstall
cp/usr/local/src/PHP-5.5.38/PHP.ini-production/usr/local/PHP/etc/PHP.ini
mv/usr/local/PHP/etc/PHP-fpm.conf.default/usr/local/PHP/etc/PHP-fpm.conf
useradd-M-s/sbin/nologinPHP
sed-i-e's\;pid=run/PHP-fpm.pid\pid=run/PHP-fpm.pid\g'-e's\nobody\PHP\g'-e's\listen=127.0.0.1:9000\listen=0.0.0.0:9000\g'/usr/local/PHP/etc/PHP-fpm.conf
sed-i's\;daemonize=yes\daemonize=no\g'/usr/local/PHP/etc/PHP-fpm.conf
/usr/local/PHP/sbin/PHP-fpm&

}

PHP_check(){

netstat-ntlp|grepPHP
a=`echo$?`
if[$a-eq0];then
echo"PHPisinstalld"
else
echo"PHPisn'tinstalld"
fi
}

MysqL_install(){
$aMysqLMysqL-server
systemctlstartMysqLd
MysqLadmin-uroot-password"123456"
MysqL-uroot-p123456-e"createdatabasewordpress"
MysqL-uroot-p123456-e"showdatabases"
MysqL-uroot-p123456-e"grantallprivilegeson*.*to'root'@'%'identifiedby'123456';FLUSHPRIVILEGES;"
}


MysqL_check(){
netstat-ntlp|grepMysqL
if[$?-eq0];then
echo"MysqLdisinstalld"
else
echo"MysqLdisn'tinstalld"
fi

}

wordpress_install(){
mkdir/web
cd/web/
wgethttps://cn.wordpress.org/wordpress-4.8-zh_CN.tar.gz
tarzxvfwordpress-4.8-zh_CN.tar.gz
cp�Crdwordpress/*/web
cpwordpress/wp-adminwordpress/wp-contentwordpress/wp-includes-r/web

}


main(){
yum_gpk
Nginx_install
Nginx_check
PHP_install
PHP_check
MysqL_install
MysqL_check
wordpress_install
}


main

仅提供参考,后续有待完善代码。。。。

原文链接:https://www.f2er.com/centos/376366.html

猜你在找的CentOS相关文章