RE: Вопрос по перловому модулю и error_page

Igor Savchenko dicsydel at gmail.com
Tue Dec 11 13:26:05 MSK 2007


Вот прмимер конфига:

user www-data;
worker_processes  2;

error_log  /var/log/nginx/error.log debug;
pid        /var/run/nginx.pid;

events {
    worker_connections  2048;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;


    access_log  /var/log/nginx/access.log;


    sendfile        on;
    keepalive_timeout  30;
    tcp_nodelay        on;

    gzip  off;

    perl_modules  /var/www/perl/nginx;
    perl_require  handler.pm;

    server {
        listen       80;
        server_name  localhost;

        rewrite       ^/docs   http://docs.site.com;

        access_log  /var/log/nginx/localhost.access.log;

        location / {

        error_page   404 =302 /docs;

        }


        location = /rest/PhotoEditService {
                rewrite ^(.*)$  /rest/PhotoEditService.php   last;
        }

        location = /soap/PhotoEditService {
                rewrite  ^(.*)$  /soap/PhotoEditService.php  last;
        }

        location ~* \.php$    {
                fastcgi_pass       unix:/var/fastcgi.sock;
                fastcgi_index  index.php;

                fastcgi_intercept_errors on;

                fastcgi_connect_timeout       10;
                fastcgi_send_timeout          10;
                fastcgi_read_timeout          360;


                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_param  SCRIPT_FILENAME
/var/www/www/$fastcgi_script_name;
                fastcgi_param  REQUEST_URI        $request_uri;
                fastcgi_param  DOCUMENT_URI       $document_uri;
                fastcgi_param  DOCUMENT_ROOT      /var/www/www;
                fastcgi_param  SERVER_PROTOCOL    $server_protocol;

                fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
                fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

                fastcgi_param  REMOTE_ADDR        $remote_addr;
                fastcgi_param  REMOTE_PORT        $remote_port;
                fastcgi_param  SERVER_ADDR        $server_addr;
                fastcgi_param  SERVER_PORT        $server_port;
                fastcgi_param  SERVER_NAME        $server_name;

                client_body_buffer_size 0;

                error_page   404 =302 /offloaddocs;
                error_page   502 = @errors;
        }

        location @errors
        {
                perl Handler::RequestHandler;
        }

        # Resources
        location ~* \.(gif|jpg|jpeg|png|ttf)$ {
                perl Handler::RequestHandler;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www/nginx-errors;
        }

        location = /maintenance.html {
            root   /var/www/nginx-default;
        }   


    }

}

Если выполнить запрос на location ~* \.(gif|jpg|jpeg|png|ttf)$ то перловый
модуль нормлаьно срабатывает.
Если запрос попадает @errors то пример дебаг лога я приводил.. в чем может
быть проблема?

> По идее, должно работать.


-- 
Игорь Сысоев
http://sysoev.ru






More information about the nginx-ru mailing list