Nginx 設定產生器
為常見設定情境產生 nginx.conf 片段。
伺服器設定
選擇應用類型並預覽經過驗證的 Nginx 設定。
憑證路徑僅為範例。啟用 HTTPS 前請先取得並安裝憑證;本工具不會簽發憑證。
重新載入前請先檢查: nginx -t
nginx.conf
# Generated by KitLocal — run nginx -t before reload.
server {
listen 443 ssl;
server_name example.com;
# Obtain the certificate before enabling this server.
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_types text/plain text/css application/json application/javascript image/svg+xml;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}
31 行907 位元組nginx.conf