Re: Непонятная ошибка в header.

maxhl at hitline.net.ua maxhl at hitline.net.ua
Tue Sep 9 17:32:03 MSD 2008


Попробовал тоже самое только на perl.
Все точно так же первый раз есть потом нет.
В access логе не пишется ип из переменной X_SRC_CLIENT_IP
а всегда ип socks сервера.
____________________________________________
#!/usr/bin/perl5
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}
____________________________________________

fastcgi_connect_timeout 30;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
fastcgi_intercept_errors on;

fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
fastcgi_param   PATH_INFO       "http://$http_host$request_uri";


fastcgi_param   QUERY_STRING    $query_string;
fastcgi_param   CONTENT_TYPE    $content_type;
fastcgi_param   CONTENT_LENGTH  $content_length;
fastcgi_param   DOCUMENT_URI    $document_uri;
fastcgi_param   REQUEST_METHOD  $request_method;

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;

fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
fastcgi_param   SERVER_PROTOCOL $server_protocol;
fastcgi_param   DOCUMENT_ROOT   $document_root;
fastcgi_param   REQUEST_URI     $request_uri;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
#fastcgi_param  REDIRECT_STATUS 200;
#       proxy_set_header Host $host;
#       proxy_set_header X-Real-IP $remote_addr;


proxy_set_header  X_SRC_CLIENT_IP       $http_x_src_client_ip;
proxy_set_header  X-Real-IP             $http_x_src_client_ip;

set_real_ip_from   192.168.13.34
real_ip_header     X-Real-IP;

____________________________________________
                location ~ .pl$  {
                        fastcgi_pass    unix:/mnt/md0/nginx-fcgi.sock;
                        fastcgi_index    index.cgi;
                        include  /usr/local/nginx/conf/fastcgi.conf;
                        fastcgi_param   SCRIPT_FILENAME 
/home/content$fastcgi_script_name;
                }
_________________________________________________________________________
Пускалка перловых скриптов в аттаче.
Только для серьезной нагрузки непредназначена ...
Для временных файлов используется мемори диск /mnt/md0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-fcgi42.pl
Type: application/octet-stream
Size: 6625 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20080909/42dc867c/attachment.obj>


More information about the nginx-ru mailing list