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;
}
'''