Re: Почему могут не работать вложенные location

andrey311 nginx-forum на nginx.us
Пн Июл 11 03:28:18 UTC 2011


спасибо. уже понял это.

вот конечный переделанный вариант:

server {

  listen       80;
  server_name  s2.myninja.ru www.s2.myninja.ru;
  access_log   /home/user/engine-env/logs/access.log;
  
  location @php {
    rewrite ^/(.*)$ /index.php?q=$1 last;
  }
  
  location / {
    root    /home/user/engine-env/projects/s2.myninja.ru;
    index   index.php;
    
    try_files $uri @php;
    
    location ~ \.php$ {
      fastcgi_split_path_info ^(.+\.php)(.*)$;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME 
/home/user/engine-env/projects/s2.myninja.ru$fastcgi_script_name;
      include fastcgi_params;
      fastcgi_param  QUERY_STRING     $query_string;
      fastcgi_param  REQUEST_METHOD   $request_method;
      fastcgi_param  CONTENT_TYPE     $content_type;
      fastcgi_param  CONTENT_LENGTH   $content_length;
      fastcgi_intercept_errors        on;
      fastcgi_ignore_client_abort     off;
      fastcgi_connect_timeout         60;
      fastcgi_send_timeout            180;
      fastcgi_read_timeout            180;
      fastcgi_buffer_size             128k;
      fastcgi_buffers                 2 256k;
      fastcgi_busy_buffers_size       256k;
      fastcgi_temp_file_write_size    256k;
    }
    
    location ~* \.(jpg|jpeg|gif|css|png|js|ico|xml|html|htm|swf)$ {
      access_log    off;
      expires       30d;
      add_header    Cache-Control public;
    }
    
    location ~ \.mp4$ {
      mp4;
    }
    
    location ~ /\.ht {
      deny all;
    }
    
  }
  
  location /i/ {
    access_log    off;
    expires       30d;
    add_header    Cache-Control public;
    root    /home/user/engine-env/engine;
  }
  
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,212050,212056#msg-212056




Подробная информация о списке рассылки nginx-ru