CentOS6.5 搭建WordPress
由于公司有需要员工书写技术文章的想法,所以才有了在公司服务器上搭建WordPress的想法。
需要的软件&库
WebServer:Nginx
DataBase:MySQL
RunEnvoriment : php7.5
WordPress
mysql配置
//为WordPress创建对应的数据库即可
create database wordpress;
nginx配置
server {
listen 80;
server_name xxx.xxx.xxx;
root /var/www/html/wordpress;
try_files $uri $uri/ /index.php?q=$uri&$args;
error_log /imgData/nginx/wordpress/error.log;
access_log /imgData/nginx/wordpress/access.log;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
root /var/www/html/wordpress;
fastcgi_pass 127.0.0.1:9905;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
php配置
[wordpress]
listen = 127.0.0.1:9905
listen.allowed_clients = 127.0.0.1
user = nginx
group = nginx
pm = dynamic
pm.max_children = 50
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 35
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
WordPress配置
/* 主要配置MySQL部分 */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'xxx');
/** MySQL database password */
define('DB_PASSWORD', 'xxx');
/** MySQL hostname */
define('DB_HOST', 'xxx.xxx.xxx.xxx');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
启动WordPress
chconfig add php-fpm
chconfig php-fpm on
service php-fpm start