0Pricing
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) · Ders

Nginx Konum Blokları ve İstek Eşleştirme

Gelen her isteği hangi yapılandırmanın işleyeceğine karar veren eşleştirme kurallarıyla birlikte Nginx konum bloklarını öğrenin.

Nginx Konum Blokları ve İstek Eşleştirme, CoddyKit'te ücretsiz bir API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersidir. Bu, 4 dersinin 4. 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, API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

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

Why Location Blocks Matter

A real site serves many paths differently: static files, an API, an admin area. Location blocks let Nginx apply different rules per URL path.

Anatomy of a Location

A location block matches a request URI and contains directives for it.

location /images/ {
  root /var/www;
}

Prefix Matching

By default a location is a prefix match: location /blog matches /blog, /blog/post, and anything starting with it.

location /blog {
  # matches /blog, /blog/, /blog/anything
}

Exact Match with =

The = modifier requires an exact URI. It is fast and great for hot paths like the health endpoint or homepage.

location = /health {
  return 200 'ok';
}

Regex Matching

Use ~ for case-sensitive and ~* for case-insensitive regular expressions, handy for file extensions.

location ~* \.(jpg|png|gif)$ {
  expires 30d;
}

The Matching Priority

Nginx does not just pick the first match. Order of precedence:

  • = exact match wins immediately
  • ^~ prefix stops regex search
  • regex (~/~*) in file order
  • longest plain prefix as fallback

The ^~ Modifier

^~ means: if this prefix is the longest match, use it and skip regex checking. Useful to protect a static directory from regex rules.

location ^~ /static/ {
  root /var/www;
}

Longest Prefix Wins

Among plain prefixes, the longest match is chosen, not the first listed. /api/v2 beats /api for a request to /api/v2/users.

Combining with proxy_pass

Location blocks commonly route to backends. Different paths can proxy to different upstreams.

location /api/ {
  proxy_pass http://127.0.0.1:8080;
}

Nested and Named Locations

Locations can nest inside others, and named locations (@name) are jumped to internally, often for fallbacks like try_files.

location / {
  try_files $uri @app;
}
location @app {
  proxy_pass http://backend;
}

Debugging Matches

When a request hits the wrong block, check: is there an exact or ^~ match stealing it? Is a regex matching unexpectedly? Reload and test with curl -v.

nginx -t && nginx -s reload

Quick Check

Test your location matching knowledge.

Recap

You learned Nginx location matching:

  • Prefix match is the default; = is exact
  • Regex uses ~ and ~*
  • Priority: exact, then ^~, then regex, then longest prefix
  • Longest prefix wins among plain matches
  • Named locations enable fallbacks; test with nginx -t and reload

Sıkça Sorulan Sorular

“Nginx Konum Blokları ve İstek Eşleştirme” dersi ücretsiz mi?

Evet — “Nginx Konum Blokları ve İstek Eşleştirme” 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 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

“Nginx Konum Blokları ve İstek Eşleştirme” dersinde ne öğreneceğim?

Gelen her isteği hangi yapılandırmanın işleyeceğine karar veren eşleştirme kurallarıyla birlikte Nginx konum bloklarını öğrenin. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 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.

API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), 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 4. dersidir.

“Nginx Konum Blokları ve İstek Eşleştirme” 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 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersinde kod yazıp çalıştırabilir miyim?

Evet. Her API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 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. Nginx Kurulumu ve Ayarları
  2. Temel Nginx Yapılandırması
  3. Nginx ile Statik İçerik Sunma
  4. Nginx Konum Blokları ve İstek Eşleştirme
← API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) Sayfasına Dön