Simple configuration for stopping nginx and php in windows

Source: Internet
Author: User
In windows, nginx + php is simple to Configure Nginx & #43; although nginx is widely used, mainstream Internet sites in mainland China are more or less likely to use small applications developed by the Russians (with low resource usage ). However, for the first time, I configured my configuration independently. I had a lot of online materials, but I still encountered some problems. Step 1: Download nginx + php simple configuration in ngin windows
Build the Nginx + php runtime environment

Although nginx is widely used at present, the mainstream internet sites in mainland China will more or less use small applications developed by the Russians (with small resource usage ). However, for the first time, I configured my configuration independently. I had a lot of online materials, but I still encountered some problems.

Step 1: Download nginx and php. Since mysql has been installed on the local machine, it has not been re-installed. There should be no problem in installing mysql. It will also be used in the configuration of other development environments. generally, it is very skillful, so we will not mention the installation and configuration of mysql on the cloud.

Php has been downloaded in the previous test environment. I used php5.2.14 and nginx to Download Version 1.4.0. The compressed package is actually less than 2 MB.

Step 2: decompress php and nginx. for configuration convenience, I created a directory named nginx under the root directory of the c drive, and decompress nginx and php to this folder. The directory structure after decompression.

Step 3: Configure php. Go to the php-5.2.14 Directory, find php. ini-recommended, copy a copy, change the name to: php. ini, open the file, and configure.

Find extension_dir = "./ext" and change to: extension_dir = "c:/nginx/php-5.2.14/ext ";

Find; extension = php_mysql.dll and; extension = php_mysqli.dll and remove the semicolon;

Next we will configure php so that php can be combined with nginx. Find; cgi. fix_pathinfo = 1

We will remove the title here. Cgi. fix_pathinfo = 1

This step is very important. here is the CGI setting of php.

Step 4: Configure nginx. Open conf/nginx. conf in the nginx directory and find

# Pass the PHP scripts to FastCGI serverlistening on Fig: 9000


# Location ~ \. Php $ {

# Root html;

# Fastcgi_pass 9000;

# Fastcgi_index index. php;

# Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;

# Include fastcgi_params;


Remove the # sign before this configuration file, and then modify # fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name; for example $ document_root $ fastcgi_script_name; the document_root here is the path specified by the preceding root html, is the path where web applications are stored.

Save the configuration file. the configuration is complete.

Finally, you can start the server and verify the environment.

I am still used to starting services on the console. First, start php-cgi, open the console, cd to the nginx/php-5.2.14 directory of drive C, and then tap the following command:

Php-cgi.exe-B 9000-c php. ini

Start the php-cgi service.

Then open another console, go to the nginx/nginxdirectory of drive C, and click nginx.exe to start the nginx server.

In the nginx/html Directory, create a new file named phpinfo. php. open the file and write the following code into the file,

Phpinfo ();


Open the browser and enter http: // localhost/phpinfo. php in the browser,

The Nginx + php environment has been set up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.