Иногда nginx не отправляет данные обратно в браузер (ERR_EMPTY_RESPONSE
в Chrome).
После проверки журнала ошибок сервера я обнаружил эти странные сообщения:
2013/10/20 23:57:40 [alert] 29146#0: *35 pread() read only 4653 of 4656 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:57:45 [alert] 29146#0: *36 pread() read only 4653 of 4656 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:18 [alert] 29146#0: *38 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:18 [alert] 29146#0: *39 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:19 [alert] 29146#0: *40 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:21 [alert] 29146#0: *41 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:21 [alert] 29146#0: *42 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:23 [alert] 29146#0: *43 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:31 [alert] 29146#0: *44 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:46 [alert] 29146#0: *45 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
Кто-нибудь знает, почему это происходит? Через некоторое время все снова будет подано правильно.
я нашел эта ветка русского форума это говорит, что это связано с open_file_cache
директивы.
Имеет смысл, поскольку я использую Sublime Text и он не сохраняет атомарные файлы.
У меня была такая же проблема, после многих поисков, ее разрешил open_log_file_cache
open_log_file_cache max=20000 inactive=30s min_uses=2;
Это не связано с вашим вопросом, но для других посетителей, которые ищут лучшие практики кеширования файлов nginx, это моя полная конфигурация кеширования файлов после многих поисков и выполнения многих тестов.
# cache information about FDs, frequently accessed files
aio threads; # linux kernel > 2.6.22
open_file_cache max=10000 inactive=120s; # removed from the cache if it has not been accessed during `inactive` time
open_file_cache_valid 120s; # Sets a time after which open_file_cache elements should be validated.
open_file_cache_min_uses 2; # Sets the minimum number of file accesses during the period configured by the inactive parameter
open_file_cache_errors off; # Enables or disables caching of file lookup errors by open_file_cache.
open_log_file_cache max=20000 inactive=30s min_uses=2;