2014重新建立wordpress
1.启动fastcgi
2.nginx关联fastcgi,运行php
3.nginx连接wordpress,php建立mysql的基础库,
centos6.5上安装
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc mysql mysql-server mysql-devel php-devel php
启动fastcgi
[root@haoning fastcgi]# cat fast.sh
#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u haoning -g haoning -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid
[root@haoning fastcgi]#
建立用户
useradd haoning -G haoning
启动nginx和web的用户
nginx的配置文件
指定log目录和wordpress的目录为
ser haoning;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
server {
listen 80;
server_name 203.195.183.79;
access_log /home/haoning/log/access.log;
location / {
root /home/haoning/www;
index index.html index.htm index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "/";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/haoning/www;
}
fastcgi_param SCRIPT_FILENAME /home/haoning/www/$real_script_name;
fastcgi_param script_name $real_script_name;
fastcgi_param path_info $path_info;
include /usr/local/nginx_wordpress/conf/fastcgi_params;
}
}
下载
cd /data/wordpress
wget http://cn.wordpress.org/wordpress-3.5.2-zh_CN.tar.gz
tar zxvf wordpress-3.5.2-zh_CN.tar.gz
ln -s /data/wordpress/wordpress /home/haoning/www
mysql:
mysql -uroot -h203.195.183.79 -p
create database haowordpress;
grant all on *.* to root@'%' identified by "mima" WITH GRANT OPTION;
flush privileges;
安装mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/var/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
make
make install
cp ./script/mysql_install_db .
./mysql_install_db --user=mysql
启动
/usr/local/mysql/bin/mysqld_safe --user=mysql &
配置文件
cp wp-config-sample.php wp-config.php
vim wp-config.php
修改数据库连接,尽量不要用localhost,用实际ip
启动fastcgi,启动nginx
访问
http://haoning.net/