Enabling SSI when using a proxy
    François Battail 
    fb at francois.battail.name
       
    Sat Oct 17 15:36:56 MSD 2009
    
    
  
Dear list,
I've troubles for having SSI working with proxy_pass, when I use FastCGI
it works fine. I believe I've made a mistake but so far it's a mistery
for me!
The PHP code proxied looks like this:
<?php
  echo '<!--# include virtual="/ssi/content.html" -->' ;
?>
and the site configuration like this:
# nginx 0.8.20
upstream apache
{
  server 127.0.0.1:8080 ;
}
server 
{
  listen 80 ;
  server_name localhost ;
  ssi on ;
  access_log  /var/log/nginx/localhost.access.log ;
  location / 
  {
    ssi on ;
    root /home/fb/www ;
    location /ssi
    {
      internal ;
    }
  }  
  error_page  404  @php ;
  error_page  403  @php ; # for the main page eg: "/"
  # proxy the PHP scripts to Apache listening on :8080
  location @php 
  {
    rewrite ^(.*)$ /index.php?$1 break ;
    proxy_set_header  X-Real-IP  $remote_addr ;
    proxy_redirect off ;
    ssi on ;	
    proxy_pass http://apache ;
  }
}
The SSI directive is not processed by Nginx when the upstream reply (it
appears as an html comment).
Does anyone have a clue?
Best regards
    
    
More information about the nginx
mailing list