WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的网站。也可以把 WordPress当作一个内容管理系统(CMS)来使用. WordPress是一款个人博客系统,并逐步演化成一款内容管理系统软件
官网:https://wordpress.org/
官方文档:https://codex.wordpress.org/Main_Page
wordpress最新版下载(目前最新版是4.8):https://wordpress.org/latest.tar.gz
wordpress安装要求:https://wordpress.org/about/requirements/
1 2 3 4
| php version >= 7 mysql version >=5.6 or MariaDB version >= 10.0 https support
|
官方安装文档:https://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install
安装LNMP环境
环境:
Centos 7.3
wordpress version 4.8
mysql version 5.6.36
php version 7.1.5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| [root@localhost ~] [root@localhost ~] [root@localhost ~] mysql.service enabled mysqld.service enabled [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
安装wordpress
1 2 3
| [root@localhost ~] [root@localhost ~]
|
配置nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| [root@localhost ~] [root@localhost conf.d] server { listen 80; server_name 192.168.1.199; root /usr/local; location /wordpress { index index.php; access_log /var/log/nginx/host_wordpress.access.log main; try_files $uri $uri/ /index.php?$args; } location /info { index index.php; try_files $uri $uri/ /index.php?$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location ~ ^(.+.php)(.*)$ { fastcgi_split_path_info ^(.+.php)(.*)$; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; } } [root@localhost conf.d] [root@localhost conf.d] nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@localhost conf.d] [root@localhost ~] [root@localhost ~]
|
访问http://ip/info
访问http://ip/wordpress
1 2 3 4
| mysql> create database wordpress DEFAULT CHARACTER SET utf8; mysql> create user wordpress_user identified by 'wordpress_pass'; mysql> grant all privileges on wordpress.* TO 'wordpress_user';
|
1 2
| [root@localhost ~] [root@localhost wordpress]
|
如果打开时报这个错误,是因为没有正确在 wp-config.php 配置mysql数据库连接信息
1
| Error establishing a database connection
|
1 2 3 4 5 6 7 8
| [root@localhost wordpress] define('DB_NAME', 'wordpress'); define('DB_USER', 'wordpress_user'); define('DB_PASSWORD', 'wordpress_pass'); define('DB_HOST', '192.168.1.199'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); [root@localhost wordpress]
|
Wordpress安装成功
附件:
wordpress-4.8.tar.gz
mysql57-community-release-el7-11.noarch.rpm
此mysql yum源安装后,修改mysql-community.repo即可
本文出自”Jack Wang Blog”:http://www.yfshare.vip/2017/06/25/部署wordpress/