首先找到nginx配置文件nginx.conf
[root@localhost ~]# whereis nginx
nginx: /usr/local/nginx
[root@localhost ~]# cd /usr/local/nginx/conf
[root@localhost conf]# ll
总用量 68
-rw-r--r--. 1 root root 1077 6月 10 13:05 fastcgi.conf
-rw-r--r--. 1 root root 1077 6月 10 13:05 fastcgi.conf.default
-rw-r--r--. 1 root root 1007 6月 10 13:05 fastcgi_params
-rw-r--r--. 1 root root 1007 6月 10 13:05 fastcgi_params.default
-rw-r--r--. 1 root root 2837 6月 10 13:05 koi-utf
-rw-r--r--. 1 root root 2223 6月 10 13:05 koi-win
-rw-r--r--. 1 root root 5231 6月 10 13:05 mime.types
-rw-r--r--. 1 root root 5231 6月 10 13:05 mime.types.default
-rw-r--r--. 1 root root 3457 7月 21 16:06 nginx.conf
-rw-r--r--. 1 root root 2656 6月 10 13:05 nginx.conf.default
-rw-r--r--. 1 root root 636 6月 10 13:05 scgi_params
-rw-r--r--. 1 root root 636 6月 10 13:05 scgi_params.default
-rw-r--r--. 1 root root 664 6月 10 13:05 uwsgi_params
-rw-r--r--. 1 root root 664 6月 10 13:05 uwsgi_params.default
-rw-r--r--. 1 root root 3610 6月 10 13:05 win-utf
[root@localhost conf]# vim nginx.conf
这里使用vim进行编辑
......
server {
......
location / {
#表示每个连接允许的速率为1Mbit,最大连接数10个
limit_conn one 10;
···
}
location ~/group([0-9])/ {
···
#表示在不限流10Mbit后开始限流
limit_rate_after 10m;
#限流后的网速
limit_rate 2m;
····
}
}
修改了nginx.conf文件后重新加载配置文件
[root@localhost /]# /usr/local/nginx/sbin/nginx -s reload
ngx_http_fastdfs_set pid=7988