Software version:
Nginx:nginx-1.1.7.zip
Php:php-5.3.6-nts-win32-vc9-x86.zip
Mysql:mysql-essential-5.1.57-win32.zip
Convenient package software: Phpsys
First install Mysql, direct decompression installation to the directory, I install here in F:/wamp/mysql
Next installs the Nginx, will extract Nginx to the same directory, F:/wamp/nginx
Finally unzip PHP, directory for f:/wamp/php
Start configuration:
Double-click Nginx.exe under Nginx to see if the service is started in Task Manager, open a browser to access http://localhost/or HTTP://127.0.0.1/, and see the browser output: Welcome to
nginx!, the output is actually in the Nginx directory under the HTML under the Index.html, in the configuration file (nginx.conf) can view the document directory
Location/{
root HTML;
Index index.html;
index.htm;
}
Nginx load PHP
1. Modify its configuration file, set the doc directory and load PHP
Location/{
Root f:/wamp/www; #网站目录
Index index.html
Index.htm index.php; #加上对php的支持
AutoIndex on; #如果文件不存在列出目录结构;
}
Around 65 lines in the configuration file
Location ~ \.php$ {
Root f:/wamp/www;
Fastcgi_pass 127.0.0.1:9000 #注: fastcgi and listening ports are consistent with the PHP CGI launch
Fastcgi_index index.php; #默认首页
Fastcgi_param Script_filename F:/wamp/www$fastcgi_script_name;
Include Fastcgi_params;
}
Configure PHP:
Take the php.ini-recommended and rename it to PHP.ini. Then edit php.ini.
Basically the same as using Apache, PHP's configuration file changes are not many places, such as open extension file on the unknown, there are a number of key needs to pay attention to:
Specify the directory where docroot--php files are stored, that is, your documentroot. Doc_root = "F:/wamp/www"
The extended store directory extension_dir--changed to the real extension store address. Extension_dir = "./ext"
Default time zone change-added in [Date]: Date.timezone = asia/chongqing
Because the nginx need is the CGI way PHP, so the following several places is the key, otherwise nginx cannot open the PHP file:
ENABLE_DL = On
Cgi.force_redirect = 0
Cgi.fix_pathinfo=1
Fastcgi.impersonate = 1
Cgi.rfc2616_headers = 1
Under f:/wamp/www new index.php write PHP code to see if the resolution is successful, if not successful, copy php.ini to C:\Windows\System32
Start and stop services
First go online to download RunHiddenConsole.exe
Open php-cgi
@echo off
echo Starting PHP FastCGI ...
RunHiddenConsole.exe
F:\WAMP\PHP\php-cgi.exe-b 127.0.0.1:9000-c F:\WAMP\PHP\php.ini
Stop php-cgi and Nginx.exe
@echo off
echo Stopping Nginx ...
taskkill/f/im nginx.exe >
Nul
echo Stopping PHP FastCGI ...
taskkill/f/im php-cgi.exe >
Nul
Exit
Then configure PHP and MySQL. It's the same as apache+mysql+php.