nginx配置

nginx配置php-fpm

php-fpm.conf重要参数max_children和request_terminate_timeout

http://www.th7.cn/system/lin/201301/36475.shtml

http://www.jb51.net/article/31226.htm

http://bbs.vpser.net/thread-9339-1-1.html

基于php-fpm 参数的深入理解

http://www.jb51.net/article/37802.htm

查看当前的PHP FastCGI进程数是否够用:

netstat -anpo | grep "php-cgi" | wc -l

Nginx 502 Bad Gateway 自动重启脚本

http://bbs.vpser.net/thread-1913-1-1.html

/etc/init.d/php-fpm restart

如果设置成static,进程数自始至终都是pm.max_children指定的数量,pm.start_servers,pm.min_spare_servers,pm.max_spare_servers配置将没有作用。

https://blog.linuxeye.com/380.html

Mem=`free -m | awk '/Mem:/{print $2}'` #我的机器内存是987M

sed -i "s@^pm.max_children.*@pm.max_children= $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf

sed -i "s@^pm.start_servers.*@pm.start_servers= $(($Mem/2/30))@" $php_install_dir/etc/php-fpm.conf

sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers= $(($Mem/2/40))@" $php_install_dir/etc/php-fpm.conf

sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers= $(($Mem/2/20))@" $php_install_dir/etc/php-fpm.conf


nginx配置屏蔽蜘蛛

location / {

......其它配置

if ($http_user_agent ~* "AhrefsBot|bingbot|Googlebot|BLEXBot|blexbot|yandexbot|ahrefsbot|easouspider|Exabot|MJ12bot|SiteExplorer|DotBot") {

return 403;

}

}

检测链接

curl -I -A "Baiduspider" www.new17.cn

curl -I -A "YisouSpider" www.new17.cn

curl -I -A "Googlebot" www.new17.cn

curl -I -A "360Spider" www.new17.cn

你可能感兴趣的:(nginx配置)