2.安装wordpress
将下载好的wordpress解压并放到相关的位置:
- unzipwordpress-3.0.4-zh_CN.zip
- mkdir–p /var/www/html/wordpress
- mvwordpress/* /var/www/html/wordpress
- rm–rf wordpress
好的,接下来,我们进去配置wordpress的相关文件
- cd/var/www/html/wordpress
- cpwp-config-sample.php wp-config.php
修改wp-config.php里面的
- define('DB_NAME','wordpress');
- define('DB_USER','root');
- define('DB_PASSWORD','aaa');
- define('DB_HOST','192.168.0.44');
成为自己所对应的配置文件即可。
进入MySQL服务器,为我们的wordpress手动创建数据库以及远程访问的用户和密码
- mysql
- >CREATEDATABASE wordpress;
- >GRANT ALL PRIVILEGES ON *.* TO root@'%.%.%.%' IDENTIFIED BY 'RedHat';
- >FLUSHPRIVILEGES;
- >\q
3.配置nfs,实现文件共享
打开/etc/exports
在里面加入
- /var/www/html192.168.0.0/24(rw,async)
注意,这里面的网段对应的是你自己的Web服务器的网段
启用nfs服务
- servicenfs start
- chkconfignfs on 实现开机启动
- rpcinfo-p 检查,发现开启了许多的端口
4.开始配置两个Web服务器。
4.1.挂载nfs共享过来的目录
- mkdir/mnt/web ## 创建我们要挂载的目录
- showmount-e 192.168.0.44 ## 这个ip是你Mysql服务器的ip
- mount-t nfs 192.168.0.44:/var/www/html /mnt/web
4.2 安装httpd
我们在这里使用yum源安装httpd
- yuminstall httpd -y
4.3安装php以及相关的关联程序
- yuminstall php php-mysql php-mbstring –y
4.4配置httpd.conf
打开/etc/httpd/conf/httpd.conf
修改DocumentRoot“/var/www/html” 为DocumentRoot "/mnt/web/wordpress/"
修改<Directory"/var/www/html"> 为<Directory "/mnt/web/wordpress">
在DirectoryIndexindex.html index.html.var 中加入 index.php
加入
- AddTypeapplication/x-httpd-php .php
- AddType application/x-htppd-php-source .phps
- servershttpd start
好的,此时此刻~我们的Web服务器就已经完全配置完成了,这时候,如果你在浏览器里输入自己的Web服务器的ip则应该显示的就是一个完整的wordpress页面了!

