nginx 配置 自签名https证书
1. 下载 mkcert
https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-windows-amd64.exe
2. 执行
.\mkcert.exe aa.com.cn
会生成
3. nginx配置
https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-windows-amd64.exe
2. 执行
.\mkcert.exe aa.com.cn
会生成
aa-key.pem
aa.pem
3. nginx配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 10240;
}
http {
server_names_hash_bucket_size 64; # 增加 server_names_hash_bucket_size 的大小
include mime.types;
default_type application/octet-stream;
## 用户的 IP 地址 Sbinary remote addr 作为 ey,每个 IP 地址最多有 50 个并发连接# 你想开 几千个连接 刷死我? 超过 50 个连接,直接返回 503 错误给你,根本不处理你的请求了
limit_conn_zone $binary_remote_addr zone=TotalConnLimitZone:100m;
limit_conn TotalConnLimitZone 65535;
limit_conn_log_level notice;
##用户的 IP 地 sbinary remote addr 作为 Key
## 你想用程序每秒几百次的刷我,没戏,再快了就不处理了,直接返回 503 错误给你
limit_req_zone $binary_remote_addr zone=ConnLimitZone:100m rate=1000r/s;
limit_req_log_level notice;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 90;
#gzip on;
#aa.com.cn
upstream aa_upstream {
server 192.168.10.176:443;
}
server {
listen 80;
server_name kfsvn.lynxons.com.cn;
location / {
proxy_pass https://kfsvn_upstream;
proxy_set_header Host $host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 443 ssl;
server_name aa.com.cn;
ssl_certificate "D:/Program Files/nginx-1.24.0/aa.pem";
ssl_certificate_key "D:/Program Files/nginx-1.24.0/aa-key.pem";
location / {
proxy_pass https://aa_upstream;
proxy_set_header Host $host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

浙公网安备 33010602011771号