Problems with fastcgi php migration

Ian M. Evans ianevans at digitalhit.com
Mon Mar 10 13:48:01 MSK 2008


Igor Sysoev wrote:
>    location / {
>         root   ONE;
>    }
> 
>    location ~ \.php$ {
>         root   ONE;


Here are the locations. / passes on to php as well, because any file 
that isn't a graphic or .js or .css is processed by PHP. .shtml is the 
main .php extension:

location / {
root /usr/local/apache/htdocs;
index index.shtml index.php;
include /usr/local/nginx/conf/fastcgi.conf;
fastcgi_pass 127.0.0.1:10004;
}

location ~ \.(php|shtml)$ {
root /usr/local/apache/htdocs;
include /usr/local/nginx/conf/fastcgi.conf;
fastcgi_pass 127.0.0.1:10004;
}

location ~* ^.+\.(jpg|...other static extensions...)$ {
root /usr/local/apache/htdocs;
error_page 403 /dhe403.shtml;
expires 30d;
valid_referers  none  blocked  *.example.com example.com ;
if ($invalid_referer) {
return   403;
}
}

fastcgi.conf:

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
#fastcgi_param  PATH_INFO          $fastcgi_script_name;
set $path_info   "";
if ($fastcgi_script_name ~ "^/cr(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/evans(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/galleries(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/news(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/poll(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/posters(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/photos(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/profile(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/review(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/shop(/.+)$") {
set $path_info $1;
}
if ($fastcgi_script_name ~ "^/evansabove(/.+)$") {
set $path_info $1;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param  REDIRECT_STATUS    200;





More information about the nginx mailing list