生成证书:
openssl genrsa -des3 -out wurd.key 1024 -days 36500
openssl req -new -key wurd.key -out wurd.csr -days 36500
cp wurd.key wurd.key.org
去密码
openssl rsa -in wurd.key.org -out wurd.key
openssl x509 -req -days 36500 -in wurd.csr -signkey wurd.key -out wurd.crt
nginx配置:
client_max_body_size 50000m;
client_header_timeout 10000m;
client_body_timeout 10000m;
proxy_connect_timeout 10000m;
proxy_read_timeout 10000m;
proxy_send_timeout 10000m;
server {
listen 443 ssl;
server_name localhost;
if ($request_method !~ ^(GET|PUT|POST|DELETE)$ ) {
return 403;
}
#proxy_intercept_errors on;
#error_page 404 /40x.html;
#location = /40x.html {
# root html;
#}
#error_page 500 /50x.html;
#location = /50x.html {
# root html;
#}
ssl_certificate D://wurd.crt; #
ssl_certificate_key D://wurd.key; #
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:80;
proxy_cookie_path / "/; httponly; secure";
}
}
限制访问次数:
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
server {
location /auth/login {
limit_req zone=one burst=5 nodelay;
}