vim /usr/local/php/etc/php-fpm.conf
原有的listen = /tmp/php-cgi.sock
修改php-fpm的配置文件 vim /usr/local/php/etc/php-fpm.conf 里面的 listen = /tmp/php-fcgi.sock 改为 listen = 127.0.0.1:9000
修改nginx的配置文件 vim /usr/local/nginx/conf/nginx.conf 里面的 fastcgi_pass unix:/tmp/php-cgi.sock; 改为 fastcgi_pass 127.0.0.1:9000;
user www;
worker_processes auto;
error_log /usr/local/nginx/logs/nginx_error.log;
pid /usr/local/nginx/logs/nginx.pid;
include /usr/share/nginx/modules/*.conf;
worker_rlimit_nofile 10240;
events
{
worker_connections 2048;
}
http
{
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /usr/local/nginx/logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
#limit_conn_zone设置用于保存各种key(比如当前连接数)的共享内存的参数。5m就是5兆字节,这个值应该被设置的足够大以存储(32K5)32byte状态或者(16K5)64byte状态。
limit_conn_zone $binary_remote_addr zone=addr:5m;
limit_conn addr 100;
# cache informations about file descriptors, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
#gzip on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
server
{
fastcgi_connect_timeout 500;
fastcgi_send_timeout 500;
fastcgi_read_timeout 500;
listen 80;
server_name qingtianvip.com;
root /home/work/qingtianvip;
location / {
index index.php index.html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
}
server
{
listen 80;
server_name tp.qingtianvip.com;
root /home/work/sifan;
location / {
index index.php index.html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
}
}