WordPress + Nginx +PHP+MySQL

Windows下配置Nginx+php环境

1)php的安装与配置。

直接解压下载好的php包,到D盘wnmp目录(D:\wnmp),这里把解压出来的文件夹重命名成php5。进入文件夹修改php.ini-recommended文件为php.ini,并用Editplus或者Notepad++打开来。找到

extension_dir = "./ext"

更改为

extension_dir = "D:/wnmp/php5/ext"

往下看,再找到

;extension=php_mysql.dll
;extension=php_mysqli.dll

前面指定了php的ext路径后,只要把需要的扩展包前面所对应的“;”去掉,就可以了。

这里打开php_mysql.dll和php_mysqli.dll,让php支持mysql。

当然不要忘掉很重要的一步就是,把php5目录下的libmysql.dll文件复制到C:\Windows目录下,也可以在系统变量里面指定路径,当然这里我选择了更为方便的方法^_^。

到这里,php已经可以支持mysql了。

接下来我们来配置php,让php能够与nginx结合。找到

;cgi.fix_pathinfo=1

我们去掉这里的分号(去掉注释)。

cgi.fix_pathinfo=1

这一步非常重要,这里是php的CGI的设置。

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
      root           D:/wnmp/www;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include        fastcgi_params;
}

 

 

WordPress + Nginx + Uploads = 413 Request Entity Too Large

What I did discover was by opening Chrome's developer tools and watching the Network tab I could see the file uploads were failing. They were red and had a status code of 413: Request Entity too Large.

 

解决方法:增加一个配置项,在Nginx.conf中,

client_max_body_size 20m;

结果如下:

image

 

参考

解决NGINX PHP "No input file specified"

Nginx with PHP and MySQL on Windows 7

Setup Nginx and PHP on Windows

WordPress + Nginx + Uploads = 413 Request Entity Too Large

windows下配置nginx+php环境

posted @ 2016-08-11 17:15  霍旭东  阅读(2406)  评论(0编辑  收藏  举报