单台主机lnmp+wordpress
fpm配置
]# yum install php php-fpm php-mysql –y
]# vim /etc/php-fpm.d/www.conf 配置服务监听地址和程序运行者身份
listen = 127.0.0.1:9000
user = nginx
group = nginx
]# chown -R nginx:nginx /var/lib/php/session
]# mkdir /nginx/html -pv 创建动态数据目录
]# vim /nginx/html/phpinfo.php
<?php phpinfo(); ?>
]# service php-fpm start
mysql配置
]# yum install mysql-server -y
]# service mysqld start
]# mysql
mysql> create database wpdb;
mysql> use wpdb
mysql> grant all privileges on wpdb.* to 'wpuser'@'127.0.0.1' identified by "wpuserpass";
mysql> flush privileges;
mysql> \q
nginx配置
下载源码包
]# yum install -y make
]# yum install -y gcc
]# yum -y groupinstall "Development Tools" "Server Platfrom Development"
]# yum install pcre-devel openssl-devel zlib-devel -y 手动解决最重要的依赖关系包
]# useradd -r nginx 增加一个系统用户
]# tar -xf nginx-1.10.0.tar.gz
]# cd nginx-1.10.0/
]# ./configure –prefix=/usr/local/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/va/log/nginx.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –user=nginx –group=nginx –with-httpsslmodule –with-httpv2module –with-httpdavmodule –with-httpstubstatus_module –with-threads –with-file-aio
]# make && make install
]# vim /etc/profile.d/nginx.sh 配置PATH路径
export PATH=/usr/local/nginx/sbin:$PATH
]# . /etc/profile.d/nginx.sh
]# nginx -t 检测错误
]# /usr/local/nginx/sbin/nginx 启动服务
]# vim /etc/nginx/nginx.conf
43行 location / { root nginx/html; index index.php index.html index.htm; 46行 } 65行 location ~ \.php$ { root nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /nginx/html$fastcgi_script_name; include fastcgi_params; 71行 }
]# nginx -t
]# nginx -s reload
注意:如果出现pid无效的报错就执行如下两条命令
]# /usr/local/nginx/sbin/nginx
安装wordpress
下载安装包
解压安装包
]# unzip wordpress-4.3.1-zh_CN.zip
]# cp -R wordpress/* /nginx/html/
]# cd /nginx/html/
]# mv wp-config-sample.php wp-config.php
]# vim wp-config.php
define('DB_NAME', 'wpdb');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'wpuserpass');
define('DB_HOST', '127.0.0.1');
浏览器访问进行安装
原创文章,作者:M20-1马星,如若转载,请注明出处:http://www.178linux.com/58163