1. 首先,转移到你想放置wordpress主程序的目录下, 我使用的是/opt/www:
cd /opt/www
2. 下载最新的wordpress源码包:
wget http://wordpress.org/latest.zip
3. 解压:
unzip latest.zip
解压出来一个名为wordpress的文件夹,你什么都不需要动。
4. MySQL中创建必须要的数据库和用户:
create database wordpress;
grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'yourpass' with grant option;
flush privileges;
5. 下载并安装spawn-fcgi:
wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.bz2
tar xvjf spawn-fcgi-1.6.3.tar.bz2
cd spawn-fcgi-1.6.3
./configure && make && make install
6. 确保你已经安装了最新的PHP和PHP MySQL驱动:
yum install php
yum install php-mysql
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install nginx
8. 启动fastcgi服务:
spawn-fcgi -a 127.0.0.1 -p 53217 -P /var/run/fastcgi-php.pid -- /usr/bin/php-cgi
此时,你会发现53217端口已经被监听了
9. 配置nginx代理,也就是配置一个虚拟主机:
server {
listen 80; # your server's public IP address
server_name tinyspill.com; # your domain name
root /opt/www/wordpress; # absolute path to your WordPress installation
index index.php index.html index.htm
try_files $uri $uri/ /index.php;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass localhost:53217;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
启动Nginx服务,从你的浏览器访问nginx服务,按照提示,输入MySQL的用户名、密码、数据库名等配置,至此,一个新的wordpress博客环境就已经搭建起来了。