PHP + nginx Assembly

Source: Internet
Author: User
Tags vc9 nginx server
PHP + nginx Installation

Today try to run PHP under the WIN2K3 system with Nginx server.

Why use Nginx?
Compact and free to install.

Why are you fastcgi?
Nginx if PHP does not use the FASTCGI mode will be used in the proxy mode as well as the configuration of Apache and other problems.

Go directly to Http://windows.php.net/download to 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, VC6 x86 thread safe How to choose?
I. How to select the VC9 version and the VC6 version of PHP5.3
??? The VC6 version is compiled with the visual Studio 6 compiler, and if your PHP is built with Apache, you choose the VC6 version.
??? The VC9 version is compiled with the visual Studio 2008 compiler, and if your PHP is built with IIS, you choose the VC9 version.
second, how to choose the PHP5.3 thread safe and non thread safe version
??? First of all, in the literal sense, thread safe is threaded and thread security is performed to prevent new requirements from starting
The CGI execution of the new thread runs out of system resources. Non thread safe is non-threaded and does not thread (thread) security checks at execution time.
??? Look at two ways of doing PHP: ISAPI and fastcgi.
??? ISAPI execution mode is used in the form of DLL dynamic library, can be executed after the user request, after processing a user request will not disappear immediately, so the need for thread security check, so as to improve the execution efficiency of the program, so if it is to execute PHP with ISAPI, it is recommended to choose thread Safe version;
??? and fastcgi execution is performed with a single thread, so there is no need for thread security checks, and the removal of thread safety checks can improve execution efficiency, so if you are executing PHP in fastcgi, it is recommended that you choose the non thread safe version.

Because I have VC9 library on my computer and I want to run php-fastcgi with Nginx, so I VC9 x86 Non Thread safe version of ZIP -free version
Note: If not installed, please go to Microsoft to download the Microsoft Visual C + + SP1 Redistributable Package (x86) installation!

Install PHP:
1, decompression php-5.3.0-nts-win32-vc9-x86.zip to D:\php;
2. Copy D:\php\php.ini-development and rename to D:\php\php.ini
3. Notepad Editor D:\php\php.ini
1) Set the system default time zone to China
????? to find; Date.timezone =
??? Change to Date.timezone =PRC
2) set up the expansion pack directory
????? Find Extension_dir = "ext"
????? Change to Extension_dir = "ext"
3) Open GD2, MySQL and other expansion packs
????? find separately; Extension=php_gd2.dll and Extension=php_mysql.dll
?????? Remove the front;
4) Create a new Notepad file under the D:\php
????? Content Php-cgi.exe-b 127.0.0.1:9000-c php.ini
????? Rename or Save as Startup.bat???

Installing Nginx
1, to http://sysoev.ru/nginx/download.html download nginx latest version of WindowsNginx/windows-0.8.21.zip
2, decompression nginx-0.8.21.zip to D:\
3. Open D:\nginx-0.8.21\conf\nginx.conf with Notepad
4. Find #location ~ \.php$ {
??? Will
??????? #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;
??????? #}
??? Switch
??????? 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. Find Location/{
??? Place 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 close nginx.conf

=============== I am the dividing line of legend =============

Start the service:

Enter D:\php\ to perform startup.bat start php_fastcgi
Enter D:\nginx-0.8.21 Open Nginx.exe

Open the process Manager to see that there are two nginx.exe in the process, a php-cgi.exe process that indicates a successful start

Explore http://localhost/

Open Folder D:\nginx-0.8.21\html
Delete the index.html inside and create the new index.php content as

Refresh http://localhost/

This is a pure green installation if you want the service to run automatically every time you turn it on, add it yourself as a system service.

?

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

  • Related Article

    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.