nginx限制访问速度
2015年3月24日 13:45
location / { limit_rate_after 5m; #下载5m以后开始限速 limit_rate 100k; #每个链接限速100k }
location / { limit_rate_after 5m; #下载5m以后开始限速 limit_rate 100k; #每个链接限速100k }
./configure --prefix=/etc/nginx \ --sbin-path=/usr/sbin \ --conf-path=/etc/nginx/nginx.conf \ --pid-path=/run/nginx.pid \ --error-log-path=/var/log/nginx/error.log \ --with-http_spdy_module \ --with-http_ssl_module \ --with-ipv6
./configure --with-http_ssl_module --with-http_spdy_module
[wyq@localhost nginx-1.6.2]$ make make -f objs/Makefile make[1]: 进入目录“/home/wyq/nginx-1.6.2” cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ .... make[1]: 离开目录“/home/wyq/nginx-1.6.2” make -f objs/Makefile manpage make[1]: 进入目录“/home/wyq/nginx-1.6.2” sed -e "s|%%PREFIX%%|/usr/local/nginx|" \ -e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \ -e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \ -e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \ < man/nginx.8 > objs/nginx.8 make[1]: 离开目录“/home/wyq/nginx-1.6.2”
make install 安装
openssl genrsa -des3 -out openssl.key 1024 openssl req -new -x509 -key openssl.key -out openssl.crt -days 3650 openssl rsa -in openssl.key -out openssl_nopass.key
server{ ... listen 443 ssl spdy; ssl_certificate /home/wyq/ssl/openssl.crt; ssl_certificate_key /home/wyq/ssl/openssl_nopass.key; ... }
Host Proxy ID Protocol Negotiated Active streams Unclaimed pushed Max Initiated Pushed Pushed and claimed Abandoned Received frames Secure Sent settings Received settings Send window Receive window Unacked received data Error localhost:443 direct:// 65438 spdy/3.1 0 0 100 1 0 0 0 2 true true true 2147483647 10485760 612 0
[wyq@localhost ssl]$ openssl genrsa -des3 -out openssl.key 1024 Generating RSA private key, 1024 bit long modulus ..............++++++ ...............++++++ e is 65537 (0x10001) Enter pass phrase for openssl.key: (输入密码) Verifying - Enter pass phrase for openssl.key: (确认输入输入密码)
[wyq@localhost ssl]$ openssl req -new -x509 -key openssl.key -out openssl.crt -days 3650 Enter pass phrase for openssl.key: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:cn (国家) State or Province Name (full name) []:hubei (省份) Locality Name (eg, city) [Default City]:wuhan (城市) Organization Name (eg, company) [Default Company Ltd]:aa (公司) Organizational Unit Name (eg, section) []:it (部门) Common Name (eg, your name or your server's hostname) []:wyq (名字) Email Address []:562798392@qq.com (邮件地址)
[wyq@localhost ssl]$ openssl rsa -in openssl.key -out openssl_nopass.key Enter pass phrase for openssl.key: (输入上面设定的密码) writing RSA key
server{ .... listen 443 ssl; ssl_certificate /home/wyq/ssl/openssl.crt; ssl_certificate_key /home/wyq/ssl/openssl_nopass.key; .... }
打开/etc/apt/sources.list在头部添加下面两行 deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
Reading package lists... Done W: GPG error: http://packages.dotdeb.org stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E9C74FEEA2098A6E
gpg --keyserver keys.gnupg.net --recv-key A2098A6E gpg -a --export A2098A6E | apt-key add -