View Single Post
Old 12-10-2011, 04:50 PM   #174
ogarcia
Junior Member
ogarcia began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2011
Device: Android
Quote:
Originally Posted by chaley View Post
[..] Is php a module, or are you using CGI?
SOLVED!

I'm using php-fastcgi with nginx frontend. The problem is that the part of url book_format/19/1984___George_Orwell.epub must be passed as PATH_INFO to the CGI.

I give you my config for other users.

Code:
server {

  listen   80; ## listen for ipv4
  listen   [::]:80; ## listen for ipv6

  server_name  books.myserver.com;

  access_log  /var/log/nginx/books.access.log;
  error_log   /var/log/nginx/books.error.log;

  root   /var/www/books/htdocs;

  location / {
    index  index.php index.html index.htm;
  }

  location ~ ^.+\.php {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  PATH_INFO        $fastcgi_path_info;
    include /etc/nginx/fastcgi_params;
  }

  location ~ /\.ht {
    deny  all;
  }
}
The important is fastcgi_split_path_info ^(.+\.php)(/.*)$; that cuts the index.php to the path (by example: book_format/19/1984___George_Orwell.epub), and fastcgi_param PATH_INFO $fastcgi_path_info; that pass this part as PATH_INFO to fastcgi.

This confirms that it work fine with nginx and php-fastcgi.

Thanks!!!!
ogarcia is offline   Reply With Quote