Re: проблема с настройкой nginx+Tomcat

Дмитрий Кубышев dkubyshev на gmail.com
Чт Апр 8 13:45:33 MSD 2010


worker_processes  1;
error_log  logs/error.log  debug;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  logs/access.log  main;
    keepalive_timeout  65;

    server {
        listen       8882;

   # это томкату
   location / {
    proxy_pass http://phobos:8180;
    #proxy_redirect http://admintest.systematic.ru:8980
http://admintest.systematic.ru:8882;
    proxy_buffer_size 16k;
    proxy_buffers 4 16k;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host $http_host;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

   }

   # это сами
     location ~* ^.+\.(jpg|jpeg|gif|js|css)$ {
     root C:/admtymen_test;
     access_log off;
     expires 30d;
   }
}
}

Вот конфиг. 502 вываливается практически моментально. Очень похоже что до
томката вообще не доходит.

В еррор.логе:
*1 upstream prematurely closed connection while reading response header from
upstream, client: 192.168.21.58, server: jupiter, request: "POST
/hmao/admin/access_denied.htm HTTP/1.1", upstream: "
http://192.168.20.70:8180/hmao/admin/access_denied.htm", host:
"jupiter:8882", referrer: "http://jupiter:8882/hmao/"

8 апреля 2010 г. 12:52 пользователь Sergej Kandyla <sk.paix на gmail.com>написал:

> Дмитрий Кубышев wrote:
>
>> Настраиваю связку nginx с Tomcat. Всё более-менее работает, за исключением
>> одного момента - при отправке форм методом POST (формы поиска и логина) -
>> возврщается 502 ошибка. такое ощущение что до томката запросы не доходят.
>>
>
> Конфиги в студию.
> Томкат также может обрабатывать реквест слишком долго, из-за чего и 502 -
> понять proxy таймауты.
> и что в error_log.
>
>
>
>> log:
>> 2010/04/08 12:35:59 [debug] 1984#3556: worker cycle
>> 2010/04/08 12:35:59 [debug] 1984#3556: select event: fd:248 wr:0
>> 2010/04/08 12:35:59 [debug] 1984#3556: select event: fd:320 wr:0
>> 2010/04/08 12:35:59 [debug] 1984#3556: select timer: 500
>> 2010/04/08 12:35:59 [debug] 1984#3556: select ready 1
>> 2010/04/08 12:35:59 [debug] 1984#3556: select read 320
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 post event 007B38C0
>> 2010/04/08 12:35:59 [debug] 1984#3556: timer delta: 0
>> 2010/04/08 12:35:59 [debug] 1984#3556: posted events 007B38C0
>> 2010/04/08 12:35:59 [debug] 1984#3556: posted event 007B38C0
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 delete posted event 007B38C0
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 malloc: 00784EA0:720
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 malloc: 0078E4C8:1024
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 malloc: 0078A460:4096
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http process request line
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 WSARecv: fd:320 rc:0 716 of 1024
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http request line: "POST
>> /hmao/admin/access_denied.htm HTTP/1.1"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http uri:
>> "/hmao/admin/access_denied.htm"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http args: ""
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http exten: "htm"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http process request header line
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Host:
>> jupiter:8882"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "User-Agent:
>> Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401
>> Firefox/3.6.3"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Accept:
>> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Accept-Language:
>> ru,en-us;q=0.7,en;q=0.3"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Accept-Encoding:
>> gzip,deflate"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Accept-Charset:
>> windows-1251,utf-8;q=0.7,*;q=0.7"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Keep-Alive: 115"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Connection:
>> keep-alive"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Referer:
>> http://jupiter:8882/hmao/"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Cookie:
>> JSESSIONID=570B6C3B0EB5B5125408180E537A984D"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Pragma: no-cache"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Cache-Control:
>> no-cache"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Content-Type:
>> application/x-www-form-urlencoded"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header: "Content-Length:
>> 111"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http header done
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 event timer del: 320: 3700467006
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 0
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 1
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 test location: "/"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 test location: ~
>> "^.+\.(jpg|jpeg|gif|js|css)$"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 using configuration "/"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http cl:111 max:1048576
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 3
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 post rewrite phase: 4
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 5
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 6
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 generic phase: 7
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 access phase: 8
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 access phase: 9
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 post access phase: 10
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http client request body preread
>> 111
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http init upstream, client
>> timer: 0
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "X-Real-IP: "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script var: "192.168.21.58"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "
>> "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "Host: "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script var: "jupiter:8882"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "
>> "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy:
>> "X-Forwarded-For: "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script var: "192.168.21.58"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "
>> "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http script copy: "Connection:
>> close
>> "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header: "User-Agent:
>> Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401
>> Firefox/3.6.3"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header: "Accept:
>> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Accept-Language: ru,en-us;q=0.7,en;q=0.3"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Accept-Encoding: gzip,deflate"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header: "Referer:
>> http://jupiter:8882/hmao/"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header: "Cookie:
>> JSESSIONID=570B6C3B0EB5B5125408180E537A984D"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header: "Pragma:
>> no-cache"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Cache-Control: no-cache"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Content-Type: application/x-www-form-urlencoded"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "Content-Length: 111"
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http proxy header:
>> "POST /hmao/admin/access_denied.htm HTTP/1.0
>> X-Real-IP: 192.168.21.58
>> Host: jupiter:8882
>> X-Forwarded-For: 192.168.21.58
>> Connection: close
>> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3)
>> Gecko/20100401 Firefox/3.6.3
>> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>> Accept-Language: ru,en-us;q=0.7,en;q=0.3
>> Accept-Encoding: gzip,deflate
>> Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
>> Referer: http://jupiter:8882/hmao/
>> Cookie: JSESSIONID=570B6C3B0EB5B5125408180E537A984D
>> Pragma: no-cache
>> Cache-Control: no-cache
>> Content-Type: application/x-www-form-urlencoded
>> Content-Length: 111
>>
>> "
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http cleanup add: 0078B040
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 get rr peer, try: 1
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 socket 336
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 connect to 192.168.20.70:8180 <
>> http://192.168.20.70:8180>, fd:336 #2
>>
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 select add event fd:336 ev:0
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 select add event fd:336 ev:1
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http upstream connect: -2
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 event timer add: 336:
>> 60000:3700467006
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http finalize request: -4,
>> "/hmao/admin/access_denied.htm?" a:1, c:2
>> 2010/04/08 12:35:59 [debug] 1984#3556: *1 http request count:2 blk:0
>>
>>
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru на nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
----------- следущая часть -----------
Вложение в формате HTML было извлечено&hellip;
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20100408/db015f33/attachment.html>


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