Давненько ни к кому за помощью не обращался, но здесь уже не осталось выхода(
на 0.6.39 версии ssi работает с первой попытки (CentOS 5.2), но понадобилось управление ключами кеша (для блочного кеширования), собрал по-быстрому стенд под Дебианом и столкнулся с упорным нежеланием обрабатывать ssi. Он просто выводится "как есть" в выдаваемый пользователю html.
ssi_silent_errors дефолтный, то есть "ругаться", в данном случае молчит.
Вот исходная страничка (обе они лежат в одном каталоге ~yury/public_html/ и без проблем выдаются при запросе на localhost:81/ апача2):
# cat test.php
<?
print "Hello, world!<br>\n";
print "bla-bla-bla<br>\n";
print "<br>\n";
print '<!--# include virtual="/get_user_info/" wait="no" -->';
print "<br>\n";
print "Static part:<br>\n";
print_r(gettimeofday());
print "<br>\n";
echo gettimeofday(true);
print "<br>\n";
?>
вот страничка включаемая по ssi
# cat dynamic.php
<?
print "<br>\n";
print "Dynamic part:<br>\n";
print_r(gettimeofday());
print "<br>\n";
echo gettimeofday(true);
print "<br>\n";
?>
Вот что получаем (на выдаваемой странице щелкаем "исходный код страницы"):
Hello, world!<br>
bla-bla-bla<br>
<br>
<!--# include virtual="/get_user_info/" wait="no" --><br>
Static part:<br>
Array
(
[sec] => 1256550860
[usec] => 583855
[minuteswest] => -180
[dsttime] => 0
)
<br>
1256550860.58<br>
настройка nginx-а (хост test прописан /etc/hosts на внешний интерфейс):
# cat /etc/nginx/sites-enabled/yury
server {
listen 192.168.15.120:80;
server_name test;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
access_log /home/yury/public_html/logs_nginx/access_log combined;
error_log /home/yury/public_html/logs_nginx/error_log debug;
ssi on;
location / {
ssi on;
proxy_intercept_errors on;
proxy_pass http://localhost:81/;
}
location /get_user_info/ {
ssi on;
proxy_pass http://localhost:81/dynamic.php;
}
}
ЗЫ: ssi повключал во всех секциях уже от отчаяния... изначально в рабочем варианте на старом nginx-е она была включена только в последнем location и все работало как нужно.
В дебаг-логе (судя по строкам с ssi фильтр не находит для себя ничего интересного в первый выдаче от апача2):
# cat error_log
2009/10/26 13:03:07 [debug] 30745#0: accept on 192.168.15.120:80, ready: 0
2009/10/26 13:03:07 [debug] 30745#0: malloc: 09B77AB8:256
2009/10/26 13:03:07 [debug] 30745#0: *3 accept: 192.168.15.120 fd:9
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer add: 9: 60000:2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 epoll add event: fd:9 op:1 ev:80000001
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B682C0:672
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B6E078:1024
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B6E480:4096
2009/10/26 13:03:07 [debug] 30745#0: *3 http process request line
2009/10/26 13:03:07 [debug] 30745#0: *3 recv: fd:9 392 of 1024
2009/10/26 13:03:07 [debug] 30745#0: *3 http request line: "GET /test.php HTTP/1.1"
2009/10/26 13:03:07 [debug] 30745#0: *3 http uri: "/test.php"
2009/10/26 13:03:07 [debug] 30745#0: *3 http args: ""
2009/10/26 13:03:07 [debug] 30745#0: *3 http exten: "php"
2009/10/26 13:03:07 [debug] 30745#0: *3 http process request header line
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Host: test"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Accept-Language: ru,en-us;q=0.7,en;q=0.3"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Accept-Encoding: gzip,deflate"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Keep-Alive: 300"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Connection: keep-alive"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header: "Cache-Control: max-age=0"
2009/10/26 13:03:07 [debug] 30745#0: *3 http header done
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer del: 9: 2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 generic phase: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 test location: "/"
2009/10/26 13:03:07 [debug] 30745#0: *3 test location: "get_user_info/"
2009/10/26 13:03:07 [debug] 30745#0: *3 using configuration "/"
2009/10/26 13:03:07 [debug] 30745#0: *3 http cl:-1 max:1048576
2009/10/26 13:03:07 [debug] 30745#0: *3 generic phase: 2
2009/10/26 13:03:07 [debug] 30745#0: *3 post rewrite phase: 3
2009/10/26 13:03:07 [debug] 30745#0: *3 generic phase: 4
2009/10/26 13:03:07 [debug] 30745#0: *3 generic phase: 5
2009/10/26 13:03:07 [debug] 30745#0: *3 access phase: 6
2009/10/26 13:03:07 [debug] 30745#0: *3 access phase: 7
2009/10/26 13:03:07 [debug] 30745#0: *3 post access phase: 8
2009/10/26 13:03:07 [debug] 30745#0: *3 http init upstream, client timer: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 epoll add event: fd:9 op:3 ev:80000005
2009/10/26 13:03:07 [debug] 30745#0: *3 http script copy: "Host: "
2009/10/26 13:03:07 [debug] 30745#0: *3 http script var: "test"
2009/10/26 13:03:07 [debug] 30745#0: *3 http script copy: "
"
2009/10/26 13:03:07 [debug] 30745#0: *3 http script copy: "X-Forwarded-For: "
2009/10/26 13:03:07 [debug] 30745#0: *3 http script var: "192.168.15.120"
2009/10/26 13:03:07 [debug] 30745#0: *3 http script copy: "
"
2009/10/26 13:03:07 [debug] 30745#0: *3 http script copy: "Connection: close
"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Accept-Language: ru,en-us;q=0.7,en;q=0.3"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Accept-Encoding: gzip,deflate"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Cache-Control: max-age=0"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header:
"GET /test.php HTTP/1.0
Host: test
X-Forwarded-For: 192.168.15.120
Connection: close
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.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
Cache-Control: max-age=0
"
2009/10/26 13:03:07 [debug] 30745#0: *3 http cleanup add: 09B6EE30
2009/10/26 13:03:07 [debug] 30745#0: *3 get rr peer, try: 2
2009/10/26 13:03:07 [debug] 30745#0: *3 get rr peer, current: 0 1
2009/10/26 13:03:07 [debug] 30745#0: *3 socket 12
2009/10/26 13:03:07 [debug] 30745#0: *3 epoll add connection: fd:12 ev:80000005
2009/10/26 13:03:07 [debug] 30745#0: *3 connect to 127.0.0.1:81, fd:12 #4
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream connect: -2
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer add: 12: 60000:2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 http run request: "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream check client, write event:1, "/test.php"
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream recv(): -1 (11: Resource temporarily unavailable)
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream request: "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream send request handler
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream send request
2009/10/26 13:03:07 [debug] 30745#0: *3 chain writer buf fl:1 s:403
2009/10/26 13:03:07 [debug] 30745#0: *3 chain writer in: 09B6EE4C
2009/10/26 13:03:07 [debug] 30745#0: *3 writev: 403
2009/10/26 13:03:07 [debug] 30745#0: *3 chain writer out: 00000000
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer del: 12: 2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer add: 12: 60000:2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream request: "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream process header
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B6F488:4096
2009/10/26 13:03:07 [debug] 30745#0: *3 recv: fd:12 413 of 4096
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy status 200 "200 OK"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Date: Mon, 26 Oct 2009 10:03:07 GMT"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Server: Apache/2.2.14 (Debian)"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "X-Powered-By: PHP/5.2.11-1"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Vary: Accept-Encoding"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Content-Encoding: gzip"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Content-Length: 185"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Connection: close"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header: "Content-Type: text/html"
2009/10/26 13:03:07 [debug] 30745#0: *3 http proxy header done
2009/10/26 13:03:07 [debug] 30745#0: *3 HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Mon, 26 Oct 2009 10:03:07 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.11-1
Vary: Accept-Encoding
Content-Encoding: gzip
2009/10/26 13:03:07 [debug] 30745#0: *3 write new buf t:1 f:0 09B6F150, pos 09B6F150, size: 230 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 http write filter: l:0 f:0 s:230
2009/10/26 13:03:07 [debug] 30745#0: *3 http cacheable: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream process upstream
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe read upstream: 1
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe preread: 185
2009/10/26 13:03:07 [debug] 30745#0: *3 readv: 1:3683
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe recv chain: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe buf free s:0 t:1 f:0 09B6F488, pos 09B6F56C, size: 185 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 input buf #0
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe write downstream: 1
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe write downstream flush in
2009/10/26 13:03:07 [debug] 30745#0: *3 http output filter "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 copy filter: "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http ssi filter "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 saved: 0 state: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 parse: -2, looked: 0 09B6F56C-09B6F625
2009/10/26 13:03:07 [debug] 30745#0: *3 saved: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 ssi out: 09B6F35C 09B6F56C
2009/10/26 13:03:07 [debug] 30745#0: *3 http postpone filter "/test.php?" 09B6F390
2009/10/26 13:03:07 [debug] 30745#0: *3 http chunk: 185
2009/10/26 13:03:07 [debug] 30745#0: *3 write old buf t:1 f:0 09B6F150, pos 09B6F150, size: 230 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write new buf t:1 f:0 00000000, pos 09B6F3D4, size: 4 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write new buf t:1 f:0 09B6F488, pos 09B6F56C, size: 185 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write new buf t:0 f:0 00000000, pos 080C4C01, size: 2 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 http write filter: l:0 f:0 s:421
2009/10/26 13:03:07 [debug] 30745#0: *3 copy filter: 0 "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 pipe write downstream done
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer: 12, old: 2420996594, new: 2420996595
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream exit: 00000000
2009/10/26 13:03:07 [debug] 30745#0: *3 finalize http upstream request: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 finalize http proxy request
2009/10/26 13:03:07 [debug] 30745#0: *3 free rr peer 2 0
2009/10/26 13:03:07 [debug] 30745#0: *3 close http upstream connection: 12
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer del: 12: 2420996594
2009/10/26 13:03:07 [debug] 30745#0: *3 http upstream temp fd: -1
2009/10/26 13:03:07 [debug] 30745#0: *3 http output filter "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 copy filter: "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http ssi filter "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B70490:4096
2009/10/26 13:03:07 [debug] 30745#0: *3 ssi out: 09B704A0 00000000
2009/10/26 13:03:07 [debug] 30745#0: *3 http postpone filter "/test.php?" 09B6F470
2009/10/26 13:03:07 [debug] 30745#0: *3 http chunk: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write old buf t:1 f:0 09B6F150, pos 09B6F150, size: 230 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write old buf t:1 f:0 00000000, pos 09B6F3D4, size: 4 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write old buf t:1 f:0 09B6F488, pos 09B6F56C, size: 185 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write old buf t:0 f:0 00000000, pos 080C4C01, size: 2 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 write new buf t:0 f:0 00000000, pos 080C4BFE, size: 5 file: 0, size: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 http write filter: l:1 f:0 s:426
2009/10/26 13:03:07 [debug] 30745#0: *3 http write filter limit 0
2009/10/26 13:03:07 [debug] 30745#0: *3 writev: 426
2009/10/26 13:03:07 [debug] 30745#0: *3 http write filter 00000000
2009/10/26 13:03:07 [debug] 30745#0: *3 copy filter: 0 "/test.php?"
2009/10/26 13:03:07 [debug] 30745#0: *3 http finalize request: 0, "/test.php?" 1
2009/10/26 13:03:07 [debug] 30745#0: *3 set http keepalive handler
2009/10/26 13:03:07 [debug] 30745#0: *3 http close request
2009/10/26 13:03:07 [debug] 30745#0: *3 http log handler
2009/10/26 13:03:07 [debug] 30745#0: *3 free: 09B6F488
2009/10/26 13:03:07 [debug] 30745#0: *3 free: 09B6E480, unused: 0
2009/10/26 13:03:07 [debug] 30745#0: *3 free: 09B70490, unused: 3786
2009/10/26 13:03:07 [debug] 30745#0: *3 event timer add: 9: 65000:2421001595
2009/10/26 13:03:07 [debug] 30745#0: *3 free: 09B682C0
2009/10/26 13:03:07 [debug] 30745#0: *3 free: 09B6E078
2009/10/26 13:03:07 [debug] 30745#0: *3 hc free: 00000000 0
2009/10/26 13:03:07 [debug] 30745#0: *3 hc busy: 00000000 0
2009/10/26 13:03:07 [debug] 30745#0: *3 tcp_nodelay
2009/10/26 13:03:07 [debug] 30745#0: *3 post event 09B93F38
2009/10/26 13:03:07 [debug] 30745#0: *3 delete posted event 09B93F38
2009/10/26 13:03:07 [debug] 30745#0: *3 http keepalive handler
2009/10/26 13:03:07 [debug] 30745#0: *3 malloc: 09B682C0:1024
2009/10/26 13:03:07 [debug] 30745#0: *3 recv: fd:9 -1 of 1024
2009/10/26 13:03:07 [debug] 30745#0: *3 recv() not ready (11: Resource temporarily unavailable)
Почему нжинкс просматривает выдачу апача ssi-фильтром, не ничего интересного для обработки не находит?... в исходниках посмотрел формат описания директивы ssi, все правильно...