根据所给环境搭建lnmp
1、配置本地yum源
mkdir /opt/centos
mount CentOS-7-x86_64-DVD-1511.iso /opt/centos/
mv /etc/yum.repos.d/* /media/
vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[lnmp]
name=lnmp
baseurl=file:///root/lnmp
gpgcheck=0
enabled=1
2、yum安装所需环境
nginx
数据库
php
yum install -y nginx mariadb mariadb-server php-fpm php-mysql
3、修改配置文件
(1)vi /etc/nginx/conf.d/default.conf
修改:
location / {
root /www;
index index.php index.html index.htm;
}
location ~ .php$ {
root /www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
(2)vi /etc/php-fpm.d/www.conf
修改:
user = nginx
group = nginx
(3)vi /etc/nginx/fastcgi_params
添加下面的:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
4、部署WordPress
(1)安装unzip解压工具
yum install -y unzip
(2)解压wordprss
unzip wordpress-4.7.3-zh_CN.zip
(3)创建主目录
mkdir /www
(4)解压后的文件移动到/www下
mv wordpress/* /www/
(5)修改WordPress应用的配置文件,WordPress应用提供了wp-config-sample.php模版文件,将模板文件复制为wp-config.php,并修改
cd /www/
cp wp-config-sample.php wp-config.php
vi wp-config.php
创建WordPress数据库
create database wordpress;