2013-08-24 26 views
12
basit bir demo web sitesi için Nginx kullanıyorum

ile URL harf duyarsız hale getirmek için ve sadece böyle Nginx yapılandırmak ve içeride index.html dosya var. Yani www.abc.com/Sub/index.html'u ziyaret etmeye çalıştığımda, iyi çalışıyor. www.abc.com/sub/index.html adresini ziyaret edersem 404 döndürür.nasıl Nginx

Nginx URL'ye büyük/küçük harfe duyarlı olarak nasıl yapılandırılır?

cevap

17
server { 
    # Default, you don't need this! 
    #listen   80; 

    server_name  www.abc.com; 

    # Index and root are global configurations for the whole server. 
    index   index.html; 
    root   /home/www.abc.com/; 

    location/{ 
     location ~* ^/sub/ { 
      # The tilde and asterisks ensure that this location will 
      # be matched case insensitive. nginx does not support 
      # setting absolutely everything to be case insensitive. 
      # The reason is easy, it's costly in terms of performance. 
     } 
    } 
} 
+0

serin vay, çok teşekkürler. –

+0

me..Can için çalışmıyor yukarıdaki çözüm bana yardım edin. ~ * Çalışan tek şartı – Catmandu

+3

Bunların hepsinin URL'ler maç olacak düşünüyorsanız * içeren */sub/(örneğin o da uyacak "example.com/yellow /alt/"). Yer olmalıdır ~ * ^/sub/'(karetle birlikte). –