Install php-fpm using ppa
Installation kit
Copy codeThe Code is as follows: $ sudo apt-get install python-software-properties
Add ppa Source
Copy codeThe Code is as follows: $ sudo add-apt-repository ppa: yola/php5
Install php5-fpm
Copy codeThe Code is as follows: sudo apt-get update
Sudo apt-get install php5-fpm
Install other necessary software
Copy codeThe Code is as follows: sudo apt-get install nginx
Configure php-fpm
The php-fpm parser is in the C/S structure, and its configuration file is located:
(1)/etc/php5/fpm/php-fpm.conf
(2)/etc/php5/fpm/pool. d/
Generally, there are no strict Configuration Requirements, or I have not specifically studied the significance of each configuration parameter.
I used the tcp mode to connect to the fastcgi process, so I modified the address and port of the tcp listener and the name of the monitoring directory. I will not explain it in detail here, you can refer to the official documentation for configuration based on your needs.
Restart php5-fpm
Configure nginx
Preface
Nginx itself does not parse the php language, which is different from apache (apache has php parsing in the mod_php module ). nginx is through fastcgi client php requests to the background php5-fpm Process Manager, php5-fpm has the ability to parse php
Nginx main configuration file
File Location:/etc/nginx. conf. My configuration parameters are as follows:Copy codeThe Code is as follows: user www-data;
# Enable the cpu multi-core function
Worker_processes 2;
Worker_cpu_affinity 01 10;
# Specify the maximum number of file descriptors that can be opened by the nginx Process
Worker_rlimit_nofile 65535;
Pid/var/run/nginx. pid;
Events {
# Use the I/O model of epoll
Use epoll;
# Number of concurrent connections of a work order process, total number of concurrent connections = worker_connections * worker_processes
Worker_connections 2048;
# Multi_accept call accept () to accept as many connections as possible after Nginx receives a new connection notification
Multi_accept on;
}
Http {
Include/etc/nginx/mime. types;
Default_type application/octet-stream;
Charset UTF-8;
Server_names_hash_bucket_size 128;
Client_header_buffer_size 2 k;
Large_client_header_buffers 4 4 k;
# File size uploaded through nginx
Client_max_body_size 8 m;
# $ Remote_addr: record IP address; $ remote_user: Record remote client user name; $ request: request url and http protocol; $ status: used to record request status; $ body_bytes_sent: used to record the size of the content sent to the client file body; $ http_referer: Jump link; $ http_x_forwarded_for: the customer's real IP Address
Log_format main '$ server_name