Nginx1.x + PhP5 environment configuration in Windows

Source: Internet
Author: User

I. Resources:

Nginx: http://nginx.org/en/download.html

PHP: http://windows.php.net/download/

Ii. Directory Planning

D:/PHP

D:/PHP/PhP5

D:/PHP/nginx

D:/PHP/WWW

D:/PHP/tmp/session

D:/PHP/tmp/fileupload

Iii. nginx Configuration

And PHP combination, mainly pay attention to, see this link: http://blog.csdn.net/kimsoft/article/details/7724449

Basically

        location / {            root   d:/php/www;            index  index.html index.htm index.php;        }        location ~ \.php$ {            root           d:/php/www;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;            include        fastcgi_params;        }

Iv. PHP configuration

CD/d:/PHP/PhP5

Copy PHP. ini-development PHP. ini # copy a master configuration file

PHP configuration can refer to here: http://www.leapsoul.cn /? P = 695

CGI. fix_pathinfo = 1
Extension_dir = "D:/PHP/PhP5/EXT"

Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_pdo_mysql.dll
Extension = php_pdo_odbc.dll
Extension = php_xmlrpc.dll

Session. save_path = "D:/PHP/tmp/session"
Upload_tmp_dir = "D:/PHP/tmp/fileupload"
Date. timezone = Asia/Shanghai

5. nginx + PhP command combination

See here: http://koda.iteye.com/blog/601231

Write two scripts:

Startnginxphp5.bat

@echo offecho Starting PHP FastCGI...  RunHiddenConsole d:/php/php5/php-cgi.exe -b 127.0.0.1:9000 -c d:/php/php5/php.ini   echo Starting nginx...cd /d d:/php/nginx/d:/php/nginx/nginx.exepause

Stopnginxphp5.bat

@echo offecho Stopping nginx...  taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...  taskkill /F /IM php-cgi.exe > nul  exit 

Vi. Test

<?php  phpinfo();  ?>  

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: info-contact@alibabacloud.com 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.