Welcome! Log In Create A New Profile

Advanced

Re: SCGI

December 08, 2011 12:16PM
Andrey Repin Wrote:
-------------------------------------------------------
> Здравствуйте,
> Уважаемый(-ая, -ое) excanoe!
>
> e> Столкнулся с данной
> ошибкой: ответы от
> e> scgi сервера не сжимаются.
>
> И как вы это определили?
>
> curl -siIH "Accept-Encoding: deflate,gzip"
> http://хост/адрес_скрипта
> что говорит?
>
> e> привожу код сервера на
> руби и
> e> конфигурацию nginx
> (конфигурация
> e> тестовая):
>
> e>
> ##################################################
> ####################
>
> e> worker_processes 1;
>
> e> events{
> e> worker_connections 1024;
> e> }
>
> e> http{
> e> server_tokens off;
>
> e> default_type text/plain;
>
> e> gzip on;
> e> gzip_types text/plain;
>
> e> types{
> e> text/plain js css txt;
> e> }
>
> e> server{
> e> return 404;
> e> }
>
> e> server{
> e> server_name localhost;
>
> e> scgi_buffering off;
>
> e> location / {
> e> try_files $uri @engine;
> e> }
>
> e> location @engine {
> e> include scgi_params;
> e> scgi_pass 127.0.0.1:9000;
> e> }
> e> }
> e> }
>
> e>
> ##################################################
> ####################
>
> e> #coding: utf-8
>
> e> require "socket"
> e> require "thread"
> e> require "openssl"
> e> require "erb"
>
> e>
> scgid=Socket.new(Socket::AF_INET,Socket::SOCK_STRE
> AM,0)
> e>
> scgid.bind(Socket.pack_sockaddr_in(9000,"127.0.0.1
> "))
> e> scgid.listen(1)
>
> e> loop{
> e> scgi=scgid.accept[0]
> e> Thread.new{
> e> begin
>
> e>
> f=File.new(Time.now.to_f.to_s+".bin","wb")
> e> while(f.syswrite scgi.sysread 4096)==4096
> e> end
> e> f.close
> e> File.unlink f.path
>
> e> scgi.syswrite "Status: 200
> OK\r\nContent-Type:
> e> text/plain\r\n\r\n"
>
> e> scgi.syswrite "ok"
>
> e> #header_size =""
> e> #header_pairs =""
> e> #while (header_size=~/:/)==nil
> e> # header_size+=scgi.sysread 1
> e> #end
> e> #header_size=header_size.to_i
> e> #while header_pairs.size<header_size
> e> # header_pairs+=scgi.sysread 1
> e> #end
>
> e> #env=Hash[*header_pairs.split("\0")]
>
> e> #scgi.syswrite "Status: 200
> OK\r\nContent-Type:
> e> text/plain\r\nContent-Length:
> "+env.to_s.size.to_s+"\r\n\r\n"
> e> #scgi.syswrite env.to_s
>
> e> scgi.close
> e> rescue=>err
> e> p err
> e> end
> e> }
> e> }
>
> e> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?21,219800,219800#m
> sg-219800
>
> e> _______________________________________________
> e> nginx-ru mailing list
> e> nginx-ru@nginx.org
> e>
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
>
>
> --
> С уважением
>
> Andrey Repin (hell-for-yahoo@umail.ru)
> четверг, 08.12.2011, <20:43>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru

ответ curl

d:\temp\db\scgi>curl -siIH "Accept-Encoding: deflate,gzip" http://localhost
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 08 Dec 2011 17:11:15 GMT
Content-Type: text/plain
Connection: keep-alive

я тестирую под windows в данный момент, проверял ответы fastcgi php, отдаются как gzip.
также проверял простой текстовый файл (который в папке по умолчанию docroot).

d:\temp\db\scgi>curl -siIH "Accept-Encoding: deflate,gzip" http://localhost/index.html
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 08 Dec 2011 17:15:59 GMT
Content-Type: text/plain
Last-Modified: Mon, 04 Oct 2004 13:04:06 GMT
Connection: keep-alive
Content-Encoding: gzip
Subject Author Posted

scgi

Anton Kiryushkin October 22, 2010 07:18AM

Re: scgi

Vasiliy G Tolstov October 22, 2010 07:22AM

Re: scgi

Maxim Dounin October 22, 2010 07:36AM

Re: scgi

Anton Kiryushkin October 22, 2010 07:42AM

Re: scgi

Vasiliy G Tolstov October 22, 2010 08:26AM

Re: scgi

Igor Sysoev October 22, 2010 08:40AM

Re: scgi

Anton Kiryushkin October 22, 2010 08:54AM

Re: scgi

Anton Kiryushkin October 22, 2010 07:40AM

Re: SCGI

Andrey Repin December 08, 2011 11:52AM

Re: SCGI

excanoe December 08, 2011 12:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready