1.1安装mariadb
这里使用yum安装的
Yum install mariadb mariadb-server -y
1.2systemctl start mariadb
netstat -ntlp |grep mysql
1.3安装nginx
使用源码安装
1.4安装php
安装需要的依赖
yum -y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel bzip2
解压包
tar xf php-5.6.8.tar.bz2
预编译
./configure --prefix=/usr/local/php --enable-fpm --enable-debug --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-curl --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-config-file-path=/usr/local/php/etc --with-zlib-dir
编译安装
make -j && make -j install
1.5
[root@v1 php-5.6.8]# cp php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
copy 启动脚本
[root@v1 php-5.6.8]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
授权启动
[root@v1 php-5.6.8]# chmod +x /etc/init.d/php-fpm
将php-fpm的用户和组改为nginx
[root@v1 php-5.6.8]# vim /usr/local/php/etc/php-fpm.conf
user = nginx
group = nginx
启动php-fpm
[root@v1 php-5.6.8]# /etc/init.d/php-fpm start
Starting php-fpm done
1.5上传wordpress网站的代码
[root@v1 src]# tar xf wordpress-4.9.4-zh_CN.tar.gz -C /usr/local/nginx/html/
将此发布目录授权给nginx用户
[root@v1 src]# chown nginx. -R /usr/local/nginx/html/wordpress/
创建虚拟主机目录
[root@v1 conf]# mkdir -p /usr/local/nginx/conf/vhost
创建虚拟机主机的配置文件
[root@v1 conf]# vim /usr/local/nginx/conf/vhost/blog.wordpress.com.conf
server {
listen 80;
server_name blog.wordpress.com;
#charset koi8-r;
access_log logs/wordpress.access.log main;
location / {
root html/wordpress;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
并在主配置文件中 引用
#gzip on;
include vhost/*.conf;
1.6创建数据库
systemctl start mariadb
进入数据库中
mysql
创建数据库 并授权
MariaDB [(none)]> create database wordpress charset utf8;
MariaDB [(none)]> grant all on wordpress.* to "wordpress"@"localhost" identified by "123456";
并使其生效
MariaDB [(none)]> flush privileges;
启动php-fpm
在物理机机器中添加 解析域名
192.168.217.133 blog.wordpress.com
在浏览器 访问blog.wordpress.com