php5-cgi (or php70-cgi) 似乎是不用装的。
挤压出Nginx的性能
http://blog.csdn.net/xifeijian/article/details/20956605
改ulimit
vi /etc/sysctl.conf
fs.file-max = 70000 (貌似没用)
net.netfilter.nf_conntrack_max = 1000000 (这个?)
http://blog.chedushi.com/archives/9508 (ubuntu专用?)
fpm用的php.ini下 (/etc/php5/fpm/php.ini)
cgi.fix_pathinfo=0
去掉防syn flood攻击 (高并发下会主动堵塞apache请求 导致ab测试下 apr_socket_recv: Connection reset by peer (104))
参考: http://xmarker.blog.163.com/blog/static/226484057201462263815783/
vi /etc/sysctl.conf
net.ipv4.tcp_syncookies=0
看ulimit数
ulimit -Sn
ulimit加到30000
nginx.conf
worker_processes 12;
worker_rlimit_nofile 100000;
events {
use epoll;
worker_connections 65535;
}
php-fpm.conf (or www.conf)
改成listen = 127.0.0.1:9000, 不要用listen = /var/run/php5-fpm.sock
process.max = 65536 (这个似乎没用)
pm下4个,改大一点,一个进程30M
pm.max_requests = 50000 (这个似乎也没用)
nginx server配置下选择
fastcgi_pass 127.0.0.1:9000;
centos7下删除httpd日志后不能再次生成的问题
重启下httpd就有了
==================================
server {
listen 8080;
server_name contact2.wpcn.lc;
root /var/www/simba-git/contact2/web/;
index index.php;
# access_log /data/log/access.contact.log main;
# error_log /data/log/error.contact.log debug;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /.(ht|svn|git) {
deny all;
}
}