Software version: Nginx: nginx-1.1.7.zipphp: php-5.3.6-nts-Win32-VC9-x86.zipmysql: mysql-essential-5.1.57-win32.zip convenient package software: phpsys first install mysql, directly decompress the installation to the directory, I installed here in F:/WAMP/Mysql second..."
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 software package: phpsys
First, install mysql and directly decompress it to the directory. here I install it in F:/WAMP/Mysql
Install Nginx and decompress Nginx to the same directory. F:/WAMP/Nginx
Finally, decompress php. The directory is F:/WAMP/PHP.
Start configuration:
Double-click nginx.exe in nginx. in the task manager, you can check whether the service is started. open a browser to access http: // localhost/or http: // 127.0.0.1/. the browser output is Welcome.
Nginx !, The output is actually the HTML index.html under the nginxdirectory. you can view the document directory in the configuration file (nginx. conf ).
Location /{
Root html;
Index index.html;
Index.htm;
}
Load php with Nginx
1. modify its configuration file, set the doc directory, and load php
Location /{
Root F:/WAMP/www; # Website Directory
Index index.html
Index.htm index. php; # Added support for php
Autoindex on; # list the directory structure if the file does not exist;
}
About 65 lines in the configuration file
Location ~ \. Php $ {
Root F:/WAMP/www;
Fastcgi_pass 127.0.0.1: 9000; # Note: fastcgi and the listening port must be consistent with the cgi startup of php.
Fastcgi_index index. php; # default homepage
Fastcgi_param SCRIPT_FILENAME F:/WAMP/www $ fastcgi_script_name;
Include fastcgi_params;
}
Configure PHP:
Rename php. ini-recommended to php. ini. Edit php. ini.
Basically, like using apache, there are not many changes to the php configuration file. for example, if you open an extension file, you will not discuss it in detail. you need to pay attention to the following points:
Specify the directory where the docroot -- php file is stored, that is, your documentroot. Doc_root = "F:/WAMP/www"
Extended storage directory extension_dir -- changed to a real extended storage address. Extension_dir = "./ext"
Change the default time zone -- add Date. timezone = Asia/ChongQing in [date]
Nginx requires php in cgi mode, so the following points are important; 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
Create index. php under F:/WAMP/www and write the php code to check whether the resolution is successful. if not, copy php. ini to C: \ Windows \ System32.
Start and stop services
First, download runhiddenconsole.exe from the Internet.
Enable 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-cgiand nginx.exe
@ Echo off
Echo Stopping nginx...
Taskkill/F/IM nginx.exe>
Nul
Echo Stopping PHP FastCGI...
Taskkill/F/IM Co., php-cgi.exe>
Nul
Exit
You don't need to talk about configuring php and mysql later. it's the same as apache + mysql + php.