nginx+php Operating Environment Construction
Although the use of nginx is very wide, in the mainland mainstream Internet sites will more or less use the Russian development of small applications (small footprint). But I this earth turtle is the first time to self-configuration, online data, but still encountered some problems.
The first step is to download Nginx and PHP. Since MySQL is already installed on this machine, MySQL is not reinstalled. The installation of MySQL should be no problem, in other development environment configuration will also be used, generally very skilled, also do not mention the installation and configuration of MySQL and so on.
PHP has been downloaded in the previous test environment. The version I am using is Php5.2.14;nginx download version 1.4.0. Compressed package incredibly less than 2M look, really lean.
The second step, decompression PHP and Nginx, in order to configure the convenience, I in the C packing directory created a directory called Nginx, and then the Nginx and PHP are extracted to this folder.
The third step is to configure PHP. Enter the php-5.2.14 directory, locate the php.ini-recommended, copy it, and then modify the name to: PHP.ini, and then open the file for configuration.
Find Extension_dir = "./ext", modified to: Extension_dir = "C:/nginx/php-5.2.14/ext";
To find, Extension=php_mysql.dll, and Extension=php_mysqli.dll, to remove the preceding semicolon;
Next, let's configure PHP so that PHP can be combined with nginx. to find; cgi.fix_pathinfo=1.
We'll get rid of the number here. Cgi.fix_pathinfo=1
This step is very important, here is the CGI settings for PHP.
Fourth step, configure Nginx. Open the conf/nginx.conf in the Nginx directory to find
# Pass the PHP scripts to FastCGI serverlistening on 127.0.0.1:9000
#
#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;
#}
Remove the # number from the front of the configuration file and modify # Fastcgi_param Script_filename/scripts$fastcgi_script_name; for Fastcgi_paramscript_filename $ Document_root$fastcgi_script_name; Here document_root is the path specified by the previous root HTML, which is the path that the Web application holds.
Save the configuration file and configure the end.
Finally, you can start the server and verify the environment.
I'm still used to starting the service on the console. First, start php-cgi, open the console, CD to the C-drive nginx/php-5.2.14 directory, and then click the following command:
Php-cgi.exe-b 127.0.0.1:9000-c php.ini
Start the php-cgi service.
Then open another console, enter the Nginx/nginx directory of the C drive, Nginx.exe, start the Nginx server.
In the nginx/html directory, create a new file named phpinfo.php, open the file, write the following code in the file,
<?php
Phpinfo ();
?>
Open Browser, enter http://localhost/phpinfo.php in browser
nginx+php Simple configuration under Windows