CentOS 6.5安装WordPress(基于LNMP)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6.5安装WordPress(基于LNMP)相关的知识,希望对你有一定的参考价值。
一、LNMP环境版本说明:
OS:最小化安装CentOS 6.5
nginx:nginx-1.10.2.tar.gz
mysql:mysql-5.6.24.tar.gz
php:php-5.6.23.tar.bz2
二、搭建LNMP环境(基于最小化安装CentOS 6.5)
此处省略,详情参考http://blog.51cto.com/itops/2130205
三、安装及配置WordPress
1.下载WordPress
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz -C /usr/local
2.为WordPress在MySQL中创建一个DB及相关用户
#登录MYSQL
mysql -u root -p
#创建数据库
CREATE DATABASE wordpress; #数据库名为wordpress
#创建一个用户
CREATE USER wpuser@localhost; #用户名为wpuser
#设置密码
SET PASSWORD FOR wpuser@localhost=PASSWORD("wppassword"); #密码为wppassword
#分配用户到DB权限
GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost IDENTIFIED BY 'wppassword';
#更新权限
FLUSH PRIVILEGES;
3.配置WordPress
cp /usr/local/wordpress/wp-config-sample.php /usr/local/wordpress/wp-config.php
vi /usr/local/wordpress/wp-config.php
/** WordPress数据库的名称 */
define('DB_NAME','wordpress');
/** MySQL数据库用户名 */
define('DB_USER','wpuser');
/** MySQL数据库密码 */
define('DB_PASSWORD','wppassword');
4.配置nginx访问WordPress
vi /etc/nginx/nginx.conf
#
# The default server
#
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/wordpress; #wordpress所在目录
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/local/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root /usr/local/wordpress; #wordpress所在目录
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/wordpress$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
5.重启Nginx
service nginx reload
6.然后访问http://ip/,就可以进入WordPress的安装引导界面了。
以上是关于CentOS 6.5安装WordPress(基于LNMP)的主要内容,如果未能解决你的问题,请参考以下文章