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;
結果如下:
參考
解決NGINX PHP "No input file specified"
Nginx with PHP and MySQL on Windows 7
Setup Nginx and PHP on Windows

