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)