0Pricing
Django Academy · Ders

Ters Proxy Olarak Nginx

Gunicorn'un önünde çalışın ve statik dosyaları sunun.

Ters Proxy Olarak Nginx, CoddyKit'te ücretsiz bir Django Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Django Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Django Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Why Add Nginx

Gunicorn runs your code, but it should not face the raw internet alone. A reverse proxy sits in front and shields it. 🛡️

What a Reverse Proxy Does

A reverse proxy receives every browser request, then forwards it to Gunicorn and relays the answer back. The client never talks to Gunicorn directly.

Nginx Is Fast at Files

Nginx excels at serving static files and handling thousands of connections, freeing Gunicorn to focus only on dynamic Python work.

The Two-Layer Stack

The flow becomes browser to Nginx to Gunicorn to Django. Each layer does what it is best at, giving you speed and safety together.

A Server Block

Nginx config lives in a server block. It listens on a port and names the domain it answers for.

server {
    listen 80;
    server_name example.com;
}

Proxy to Gunicorn

Inside a location, proxy_pass tells Nginx where to send dynamic requests, usually Gunicorn on a local port or socket.

location / {
    proxy_pass http://127.0.0.1:8000;
}

Pass Real Headers

Add proxy_set_header lines so Django sees the true host and client IP, not just Nginx's local address.

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;

Serve Static Directly

Map a location for /static/ to your collected files. Nginx serves them straight from disk, skipping Gunicorn entirely for speed.

location /static/ {
    alias /app/staticfiles/;
}

Where to Connect

Nginx can reach Gunicorn over a TCP port or a faster Unix socket. Sockets avoid network overhead on the same machine.

Test Before Reload

Always check your config with nginx -t before reloading. A bad file caught here saves you from taking the site offline.

nginx -t
systemctl reload nginx

TLS Lives Here Too

Nginx is also the natural place to terminate HTTPS, decrypting traffic once before passing plain requests on to Gunicorn.

Quick Check

Pick the directive that forwards requests to Gunicorn.

Recap

You set up Nginx as a reverse proxy: it fronts Gunicorn with proxy_pass, serves static files fast, forwards headers, and handles HTTPS. 🎯

Sıkça Sorulan Sorular

“Ters Proxy Olarak Nginx” dersi ücretsiz mi?

Evet — “Ters Proxy Olarak Nginx” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Django Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Django Academy kursu toplamda 4 dersten oluşur.

“Ters Proxy Olarak Nginx” dersinde ne öğreneceğim?

Gunicorn'un önünde çalışın ve statik dosyaları sunun. Django Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Django Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Django Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.

“Ters Proxy Olarak Nginx” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Django Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Django Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. WSGI Sunucusu Olarak Gunicorn
  2. Ters Proxy Olarak Nginx
  3. Statik Dosyalar için WhiteNoise
  4. Ortam Değişkenleri ve Ayarları Ayırma
← Django Academy Sayfasına Dön