Re: Failed opening required или что nginx передает на FastCGI?

Алексей Сундуков public-mail at alekciy.ru
Wed Jul 15 05:55:10 MSD 2009


Собрал версию 0.7.61 решив не доверять версии из пакета, руками
переписал все конфиги, задал абсолютные пути, но ситуация не
изменилась.

Снифиг ни чего не дал. В дампе выданном dumpcap-ом я вижу как приходит
запрос к nginx и как он на него отвечает, но ни каких попыток
соединения с php-fpm. Хотя на сколько я помню в том же Wireshark-е
localhost адреса отснифить нельзя поэтому везде в конфиге я прописывал
реальный IP сервера.

При просмотре дампа меня вот что смутило. Несмотря на то, что через
конфиг gzip выключен, ответ от сервера все равно приходит с
Content-Encoding: gzip (смотрел через FireBug, да и по дампе видно
"Content-encoded entity body (gzip): 513 bytes -> 773 bytes"). И
второе, пакет в котором приходит 200-ый ответ от сервера приходит
битым с такой вот формулировкой: "Checksum: 0xc8af [incorrect, should
be 0x8d47 (maybe caused by "TCP checksum offload"?)]" (так Wireshark
пишет). Уж не проблемы ли это с сетевым интерейсом на сервере...

Дебаг лог получил. Конфигурация для php сейчас такая:
location ~ \.php$ {
    fastcgi_pass    ***:9001;
    fastcgi_index   index.php;
    root            /home/www/alekciy/site.ru;
    include         /usr/local/etc/nginx/fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME
/home/www/alekciy/alekciy.ru$fastcgi_script_name;
}

В дебаглоге вижу:
2009/07/15 05:50:04 [debug] 30568#0: *1 test location: "/"
2009/07/15 05:50:04 [debug] 30568#0: *1 test location: ~ "\.php$"
2009/07/15 05:50:04 [debug] 30568#0: *1 using configuration "\.php$"
2009/07/15 05:50:04 [debug] 30568#0: *1 http cl:-1 max:1048576
2009/07/15 05:50:04 [debug] 30568#0: *1 generic phase: 2
2009/07/15 05:50:04 [debug] 30568#0: *1 post rewrite phase: 3
2009/07/15 05:50:04 [debug] 30568#0: *1 generic phase: 4
2009/07/15 05:50:04 [debug] 30568#0: *1 generic phase: 5
2009/07/15 05:50:04 [debug] 30568#0: *1 access phase: 6
2009/07/15 05:50:04 [debug] 30568#0: *1 access phase: 7
2009/07/15 05:50:04 [debug] 30568#0: *1 post access phase: 8
2009/07/15 05:50:04 [debug] 30568#0: *1 http init upstream, client timer: 0
2009/07/15 05:50:04 [debug] 30568#0: *1 epoll add event: fd:8 op:3 ev:80000005
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "QUERY_STRING"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "QUERY_STRING: "
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "REQUEST_METHOD"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "GET"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "REQUEST_METHOD: GET"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "CONTENT_TYPE"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "CONTENT_TYPE: "
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "CONTENT_LENGTH"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "CONTENT_LENGTH: "
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SCRIPT_NAME"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "SCRIPT_NAME:
/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "REQUEST_URI"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "REQUEST_URI:
/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "DOCUMENT_URI"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "DOCUMENT_URI:
/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "DOCUMENT_ROOT"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var:
"/home/www/alekciy/site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "DOCUMENT_ROOT:
/home/www/alekciy/site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SERVER_PROTOCOL"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "HTTP/1.1"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param:
"SERVER_PROTOCOL: HTTP/1.1"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy:
"GATEWAY_INTERFACECGI/1.1"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param:
"GATEWAY_INTERFACE: CGI/1.1"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SERVER_SOFTWARE"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "nginx/"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "0.7.61"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param:
"SERVER_SOFTWARE: nginx/0.7.61"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "REMOTE_ADDR"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "95.79.237.40"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "REMOTE_ADDR:
95.79.237.40"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "REMOTE_PORT"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "1098"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "REMOTE_PORT: 1098"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SERVER_ADDR"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "***"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "SERVER_ADDR: ***"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SERVER_PORT"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "80"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "SERVER_PORT: 80"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SERVER_NAME"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "SERVER_NAME: site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "REDIRECT_STATUS200"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param: "REDIRECT_STATUS: 200"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy: "SCRIPT_FILENAME"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script copy:
"/home/www/alekciy/site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 http script var: "/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 fastcgi param:
"SCRIPT_FILENAME: /home/www/alekciy/site.ru/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 http cleanup add: 080F0384
2009/07/15 05:50:04 [debug] 30568#0: *1 get rr peer, try: 1
2009/07/15 05:50:04 [debug] 30568#0: *1 socket 11
2009/07/15 05:50:04 [debug] 30568#0: *1 epoll add connection: fd:11 ev:80000005
2009/07/15 05:50:04 [debug] 30568#0: *1 connect to ***:9001, fd:11 #2
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream connect: -2
2009/07/15 05:50:04 [debug] 30568#0: *1 event timer add: 11: 60000:2082148222
2009/07/15 05:50:04 [debug] 30568#0: timer delta: 3
2009/07/15 05:50:04 [debug] 30568#0: posted events 00000000
2009/07/15 05:50:04 [debug] 30568#0: worker cycle
2009/07/15 05:50:04 [debug] 30568#0: epoll timer: 60000
2009/07/15 05:50:04 [debug] 30568#0: epoll: fd:11 ev:0004 d:080F77AC
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream request: "/php_info.php?"
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream send request handler
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream send request
2009/07/15 05:50:04 [debug] 30568#0: *1 chain writer buf fl:0 s:1120
2009/07/15 05:50:04 [debug] 30568#0: *1 chain writer in: 080F03A0
2009/07/15 05:50:04 [debug] 30568#0: *1 writev: 1120
2009/07/15 05:50:04 [debug] 30568#0: *1 chain writer out: 00000000
2009/07/15 05:50:04 [debug] 30568#0: *1 event timer del: 11: 2082148222
2009/07/15 05:50:04 [debug] 30568#0: *1 event timer add: 11: 60000:2082148222
2009/07/15 05:50:04 [debug] 30568#0: epoll: fd:8 ev:0004 d:080F7750
2009/07/15 05:50:04 [debug] 30568#0: *1 http run request: "/php_info.php?"
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream check client,
write event:1, "/php_info.php"
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream recv(): -1 (11:
Resource temporarily unavailable)
2009/07/15 05:50:04 [debug] 30568#0: timer delta: 0
2009/07/15 05:50:04 [debug] 30568#0: posted events 00000000
2009/07/15 05:50:04 [debug] 30568#0: worker cycle
2009/07/15 05:50:04 [debug] 30568#0: epoll timer: 60000
2009/07/15 05:50:04 [debug] 30568#0: epoll: fd:11 ev:0005 d:080F77AC
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream request: "/php_info.php?"
2009/07/15 05:50:04 [debug] 30568#0: *1 http upstream process header
2009/07/15 05:50:04 [debug] 30568#0: *1 malloc: 080F0690:4096
2009/07/15 05:50:04 [debug] 30568#0: *1 recv: fd:11 472 of 4096
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 01
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 07
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 01
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: B6
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 02
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record length: 182
2009/07/15 05:50:04 [error] 30568#0: *1 FastCGI sent in stderr: "PHP
Warning:  Unknown: Filename cannot be empty in Unknown on line 0
PHP Fatal error:  Unknown: Failed opening required ''
(include_path='.:/usr/local/lib/php') in Unknown on line 0" while
reading response header from upstream, client: 95.79.237.40, server:
site.ru, request: "GET /php_info.php HTTP/1.1", upstream:
"fastcgi://***:9001", host: "site.ru"
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 01
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 06
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 01
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: F9
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 07
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record byte: 00
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi record length: 249
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi parser: 0
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi header: "Status:
404 Not Found"
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi parser: 0
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi header:
"X-Powered-By: PHP/5.3.0"
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi parser: 0
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi header:
"Content-type: text/html"
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi parser: 1
2009/07/15 05:50:04 [debug] 30568#0: *1 http fastcgi header done
2009/07/15 05:50:04 [debug] 30568#0: *1 HTTP/1.1 404 Not Found

Часть fastcgi param не имеют инициированного значения, может дело именно в них?

14 июля 2009 г. 23:05 пользователь Gena Makhomed (gmm at csdoc.com) написал:
> On Tuesday, July 14, 2009 at 16:49:25, Алексей Сундуков wrote:
>
> АС> я не могу понять, толи дело в nginx который не передает правильно
> АС> переменные среды, толи дело в php-fpm который их воспринимает не верно.
>
> это легко выяснить, посмотрев сниффером, что nginx передает backend`у.
> если nginx не выставляет корректные заголовки - можно собрать его
> с включенным режимом отладки и сделать debug log такого запроса.
> в результате ситуация с этим глюком должна несколько проясниться.
>
> ./configure --with-debug
>
> nginx.conf:
>
> events {
>     debug_connection  адрес;
> }
>
> PS http://www.lexa.ru/nginx-ru/msg14335.html
>
> --
> Best regards,
>  Gena
>
>
>





More information about the nginx-ru mailing list