Nginx + php Compilation

Source: Internet
Author: User
Nginxphp compilation apache generally starts using php as a module. nginx forwards http request variables (such as get and user_agent) to php processes, that is, php independent processes, and communicates with nginx. it is called fastcgi running mode. therefore, php compiled for apache cannot be used for nginx. note: We need to compile PHP

Nginxphp compilation apache generally starts using php as a module. nginx forwards http request variables (such as get and user_agent) to php processes, that is, php independent processes, and communicates with nginx. it is called fastcgi running mode. therefore, php compiled for apache cannot be used for nginx. note: We need to compile PHP

Nginx + php Compilation

Apache generally starts php as a module.

Nginx forwards http request variables (such as get and user_agent) to php processes, that is, php independent processes, and communicates with nginx. This is called fastcgi running mode.

Therefore, php compiled for apache cannot be used for nginx.

Note: The compiled PHP should have the following functions:

Connect to mysql, gd, ttf, and run in fpm (fascgi) Mode

./Configure -- prefix =/usr/local/fastphp \

-- With-mysql = mysqlnd \

-- Enable-mysqlnd \

-- With-gd \

-- Enable-gd-native-ttf \

-- Enable-gd-jis-conv

-- Enable-fpm

After compilation:

1:

Nginx + php configuration is relatively simple, and the core is just one sentence ----

Forward the request information to the PHP process on port 9000,

Let the PHP process PHP files in the specified directory.

Example:

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;

}

1: php file,

2: locate the root directory in html,

3: transfer the request context to the PHP process at port 9000,

4: Tell the PHP process that the current script is $ document_root $ fastcgi_scriptname.

(Note: PHP will find and process the script, so the script location must be correct)

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.