/root/lnmp stop
/etc/init.d/nginx stop
/etc/init.d/mysql stop
/etc/init.d/redis_6379 stop
/usr/local/php/sbin/php-fpm stop
killall nginx mysqld redis php-cgi
mkdir -p ~/src && cd ~/src
\cp -rf /usr/local/nginx/conf ~/src/conf.bak
\cp -rf /etc/init.d/nginx ~/src/nginx.bak
wget http://zlib.net/zlib-1.2.8.tar.gz -O -|tar xz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz -O -|tar xz
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz -O -|tar xz
wget http://nginx.org/download/nginx-1.2.8.tar.gz -O -|tar xz
git clone https://github.com/monadbobo/limit_req2_nginx_module
rm -rf /usr/local/nginx
cd nginx-1.2.8/
./configure --prefix=/usr/local/nginx \
--user=www --group=www \
--with-zlib=../zlib-1.2.8 \
--with-pcre=../pcre-8.32 \
--with-openssl=../openssl-1.0.1e \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-ipv6 \
--add-module=../limit_req2_nginx_module \
--with-cc-opt='-O3'
make && make install
cd ../
chkconfig nginx on
rm -rf /usr/local/nginx/conf
\cp -rf ~/src/conf.bak /usr/local/nginx/conf
\cp -rf /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
log_format lazyzhu.com '$remote_addr - $remote_user [$time_local] $request '
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
limit_req2_zone $request_uri zone=lazyzhu.com.one:2m rate=5r/s;
limit_req2_zone $binary_remote_addr zone=lazyzhu.com.two:2m rate=30r/s;
server {
listen 80;
server_name lazyzhu.com;
root /home/wwwroot/lazyzhu.com;
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
include none.conf;
## folder disable limit
location ^~ /(wp-admin|admin)/ {
limit_req2 off;
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
## file disable limit
location ~ .*(admin|p)\.(php|php5)?$ {
limit_req2 off;
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(php|php5)?$ {
limit_req2 zone=lazyzhu.com.one forbid_action=@444 nodelay;
limit_req2 zone=lazyzhu.com.two forbid_action=@444 nodelay;
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location @444 {
return 444;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location /status {
stub_status on;
access_log off;
}
access_log /home/wwwlogs/lazyzhu.com.log lazyzhu.com;
}
/etc/init.d/nginx start
/etc/init.d/mysql start
/etc/init.d/php-fpm start
尼玛,我提出的 return 444 我删除了文章又变成你的了。
关键是我没看到谁把我的CC掉,这就是事实。你的倒是被C死了。每次醒来 发表于 2013-5-4 16:45
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-h ...
灰大婶 能抗多少并发
| 欢迎光临 全球主机交流论坛 (https://loc.201812.xyz/) | Powered by Discuz! X3.4 |