cat /etc/yum.repos.d/local.repo //配置yum源
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[lnmp]
name=lnmp
baseurl=file:///root/project3/lnmp
gpgcheck=0
enabled=1
yum -y install nginx mariadb-server mariadb php-fpm php-mysql
systemctl start nginx && systemctl enable nginx
vi /etc/nginx/conf.d/default.conf
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
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;
}
systemctl restart nginx
systemctl start mariadb && systemctl enable mariadb //启动数据库
mysql_secure_installation //初始化数据库
mysql -uroot -p123456 //登录数据库
> create database wordpress; //创建数据库服务
> grant all privileges on *.* to root@localhost identified by '123456' with grant option; //授权所有用户拥有本地数据库的所有权限。
> grant all privileges on *.* to root@"%" identified by '123456' with grant option; //授权用户可进行远程登录
vi /etc/php-fpm.d/www.conf
systemctl start php-fpm && systemctl enable php-fpm
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
unzip wordpress-4.7.3-zh_CN.zip
cd /usr/share/nginx/html
rm -rf *
cp -rvf /root/wordpress/* ./
cp wp-config-sample.php wp-config.php
chmod 777 *
vi wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
使用Curl命令,返回前端页面
/** MySQL数据库用户名 */
define('DB_USER', 'root');
/** MySQL数据库密码 */
define('DB_PASSWORD', '123456');
/** MySQL主机 */
define('DB_HOST', '127.0.0.1');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');
/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');