WordPress是使用PHP语言开发的博客平台。
本文记录WordPress配合PHP、MySQL、Nginx在Windows下的安装配置。
1、下载、解压(或安装)
WordPress https://cn.wordpress.org
PHP http://windows.php.net/download
Nginx http://nginx.org/en/download.html
MySQL https://dev.mysql.com/downloads/mysql/
2、配置
2.1、MySQL
假设MySQL已经安装好并启动服务
2.2、WordPress
假设把WordPress解压到D盘
2.3、PHP
在php根目录下找到php.ini-development文件,复制一份在当前目录并且重命名为php.ini,在php.ini内容中分别找到以下3行,并去掉其前面的分号注释,保存。
;cgi.fix_pathinfo=1
;extension=php_mysqli.dll
;extension_dir = "ext"
以以下命令启动PHP:
php-cgi.exe -b 127.0.0.1:9000 -c php.ini
2.4、Nginx
更改配置文件conf/nginx.conf中的内容。
找到
location / {
root html;
index index.html index.htm;
}
修改为:
location / {
root d:/wordpress;
index index.html index.htm index.php;
}
找到
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
修改为:
location ~ \.php$ {
root d:/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
双击nginx.exe启动nginx。