Php + nginx Assembly

Source: Internet
Author: User
Tags vc9
Php + nginx installation today, I tried to use nginx as a server in WIN2K3 to run PHP. Why nginx? Small and free installation. Why fastcgi? In nginx, if php does not use fastcgi mode, you need to configure A php + nginx installation in proxy mode.

Today, I tried to use nginx as a server in the WIN2K3 system to run PHP.

Why nginx?
Small and free installation.

Why fastcgi?
In nginx, if php does not use the fastcgi mode, you need to configure Apache in the proxy mode ..

Go to http://windows.php.net/downloadto download a php zip package.
There are four different types of versions: VC9 x86 Non Thread Safe, VC9 x86 Thread Safe, VC6 x86 Non Thread Safe, and VC6 x86 Thread Safe. how can I choose?
I. how to select the VC9 and VC6 versions of PHP5.3
??? VC6 is compiled using the Visual Studio 6 compiler. if your PHP is set up using Apache, select VC6.
??? VC9 is compiled using the Visual Studio 2008 compiler. if your PHP is set up using IIS, you can select VC9.
II. how to select the Thread Safe and Non-Thread Safe versions of PHP5.3
??? First, literally, Thread Safe is Thread security. during execution, the Thread security check is performed to prevent the Thread from being started when new requirements exist.
The new thread's CGI execution method consumes system resources. Non-Thread Safe is Non-Thread security and does not perform Thread security checks during execution.
??? Let's take a look at two PHP execution methods: ISAPI and FastCGI.
??? The ISAPI is executed in the form of a DLL dynamic library. it can be executed after a user request. after processing a user request, it will not disappear immediately. Therefore, thread security check is required, in this way, the program execution efficiency is improved. if you use ISAPI to execute PHP, we recommend that you select the Thread Safe version;
??? FastCGI executes operations in a single thread, so it does not need to perform thread security checks. apart from the thread security check protection, it can improve the execution efficiency, if you use FastCGI to execute PHP, we recommend that you select the Non-Thread Safe version.

Because I have a VC9 library on my computer and I want to use nginx to run PHP-fastcgi, I can directly download the ZIP installation-free version of the Safe version of VC9 x86 Non Thread.
Note: If the Package is not installed, download Microsoft Visual C ++ 2008 SP1 Redistributable Package (x86!

Install PHP:
1. decompress php-5.3.0-nts-win32-vc9-x86.zip to D: \ php;
2. Copy D: \ php. ini-development and rename it D: \ php. ini.
3. edit D: \ php. ini in Notepad
1) set the system default time zone to China
????? Search; date. timezone =
??? Change to date. timezone = PRC
2) set the extension package directory
????? Search; extension_dir = "ext"
????? Extension_dir = "ext"
3) enable extended packages such as gd2 and mysql
????? Search separately; extension = php_gd2.dll and extension = php_mysql.dll
?????? Remove the previous one.
4) Create a notepad file under D: \ php
????? Php-cgi.exe-B 127.0.0.1: 9000-c php. ini
????? Rename or save it as startup. bat ???

Install nginx
1. go to http://sysoev.ru/nginx/download.htmlto download nginx's latest windows nginx/windows-0.8.21.zip
2. decompress nginx-0.8.21.zip to D :\
3. Use Notepad to open D: \ nginx-0.8.21 \ conf \ nginx. conf
4. search for # location ~ \. Php $ {
??? Set
??????? # 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;
??????? #}
??? Change
??????? Location ~ \. Php $ {
??????????? Root ?????????? Html;
??????????? Fastcgi_pass ?? 127.0.0.1: 9000;
??????????? Fastcgi_index index. php;
??????????? Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
??????????? Include ??????? Fastcgi_params;
??????? }

?? 5. search for location /{
??? Set location /{
??????????? Root ?? Html;
??????????? Index index.html index.htm;
??????? }
?? Change to location /{
??????????? Root ?? Html;
??????????? Index index.html index.htm index. php;
??????? }

?

Reference: http://blog.meiu.cn/nginx-proxy_cache.html
?? Save and disable nginx. conf

==================== I am the border between Legends

Start the service:

Enter d: \ php \ and execute startup. bat to start php_fastcgi
Enter D: \ nginx-0.8.21open nginx.exe

The logging manager can see that two nginx.exephp-cgi.exe processes in the process indicate that the startup is successful.

Browse http: // localhost/

Open the folder D: \ nginx-0.8.21 \ html
Delete index.html and create index. php with the following content:

Refresh http: // localhost/

This is a pure green installation. if you want to enable the service to run automatically at startup, add it as a system service.

?

Reprinted from: http://hi.baidu.com/eisn/blog/item/74ce78894b518ab90f24446a.html

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.