Nginx 配置文件
Nginx 配置文件
配置文件参考
'''conf
upstream tapi {
server 127.0.0.1:8000;
}
server {
listen 443 ssl;
server_name tapi.theemogen.com;
ssl_certificate /etc/letsencrypt/live/hostname.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hostname.com/privkey.pem;
# 启用 ModSecurity
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;
location / {
proxy_pass http://tapi;
send_timeout 90;
# 限制每个 IP 的最大连接数为 10
limit_conn perip 10;
# 限制每秒请求数量为 1,允许突发10个请求
limit_req zone=one burst=10 nodelay;
proxy_connect_timeout 50;
proxy_send_timeout 90;
proxy_read_timeout 90;
}
}
server {
listen 80;
server_name hostname.com;
return 301 https://hostname.com$request_uri;
}
'''