Nginx Yapılandırma Oluşturucu
Üretime hazır Nginx yapılandırmaları oluşturun — statik siteler, SPA'lar, ters proxy'ler ve PHP uygulamaları
nginx.conf
server {
listen 80;
server_name example.com;
client_max_body_size 10m;
root /var/www/html;
index index.html;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
location / {
try_files $uri $uri/ =404;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
location ~ /\. {
deny all;
}
}Nginx Yapılandırma Oluşturucu
Üretime hazır Nginx yapılandırmaları oluşturun — statik siteler, SPA'lar, ters proxy'ler ve PHP uygulamaları
Özellikler
- Static site, SPA, reverse proxy, or PHP server presets
- TLS / HTTPS redirect block with Let's Encrypt-friendly defaults
- Gzip compression + browser-cache headers for static assets
- Security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy)
- Optional rate limiting with `limit_req_zone` hint + per-location `limit_req`
Nasıl Kullanılır
- Sunucu türünüzü seçin (statik, SPA, ters proxy veya PHP).
- Etki alanı adınızı girin ve yolları yapılandırın.
- SSL, gzip, önbellekleme ve güvenlik başlıkları gibi özellikleri açıp kapatın.
- Oluşturulan yapılandırmayı kopyalayın ve sunucunuza kaydedin.
İpuçları ve En İyi Uygulamalar
- `limit_req_zone` MUST live in the `http {}` block, not inside `server {}`. The generator emits a comment showing where to put it.
- Test the config with `nginx -t` before reloading. The output is template-grade; expect to tune for your specific environment.
- For Let's Encrypt, run certbot once to fetch certs; the paths in the generated config (`/etc/letsencrypt/live/<domain>/`) are the standard locations.
- Reverse-proxy mode forwards to `proxy_pass http://localhost:3000` — adjust the upstream URL for your backend.
- For multi-domain configs, generate per-domain server blocks and concatenate them in `/etc/nginx/sites-available/`.
SSS
Statik ve SPA modu arasındaki fark nedir?
Statik mod bilinmeyen yollar için 404 döndürür. SPA modu tüm yolları index.html'ye yönlendirerek istemci tarafı yönlendirmeyi (React, Angular, Vue) mümkün kılar.
Gzip'i etkinleştirmeli miyim?
Evet, gzip sıkıştırma dosya boyutlarını %60-80 oranında azaltır ve sayfa yükleme sürelerini önemli ölçüde iyileştirir.
SSL'yi nasıl kurarım?
SSL'yi etkinleştirin, sertifika ve anahtar yollarınızı sağlayın, oluşturucu otomatik olarak HTTP'den HTTPS'ye yönlendirme bloğu oluşturacaktır.