个人博客https://isliang.site/2020/06/18/%e4%bd%bf%e7%94%a8wordpress%e6%90%ad%e5%bb%ba%e4%bd%a0%e7%9a%84blog/
代码下载
WordPress项目的github地址:https://github.com/WordPress/WordPress
下载代码到目标机器上,可以git clone 也可以选择Download Zip
部署
本人的安装环境 Centos7.2+PHP7.3.8+Mysql5.7.29+NGINX1.16.1
- WordPress基于PHP+Mysql,Mysql的配置放在文件wp-config.php中。下载下来的代码
默认是没有wp-config.php的,有一个示例文件wp-config-sample.php,可以根据此示例文件
配置自己的wp-config.php. - NGINX的配置
server {
listen 80;
server_name your.website;
root /path/to/WordPress;
location / {
index index.php;
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:8999;#根据自己的实际情况配置fastcgi_pass的方式和端口
fastcgi_param SCRIPT_FILENAME /path/to/WordPress$fastcgi_script_name;
include fastcgi_params;
}
}
- Mysql的配置
在Mysql中创建好DB_NAME指定的database即可,初始化程序会自动创建对应的table.
访问
在浏览器访问http://your.website,初次访问会执行初始化程序,完成后自己的blog就搭建完成了。