Need help with Sysoev's "location @drupal" code


#1

I would appreciate any help to change the script attached bellow
(between the “# — drupal cut here —” marks), to make it work
accordingly to the suggestions given by Igor S. at:
<http://www.ruby-forum.com/topic/173020#758659.

Thank you,

M.


The system includes Nginx/0.6.35 + Ubuntu 8.10 server.

We are not being able to serve drupal pages using either of the options
(A or B) proposed by Igor S.:

Option A - NOT WORKING

location / {
index index.php index.html;
log_not_found off;
error_page 404 = /index.php?q=$1;
}
location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Option B - NOT WORKING

location / {
index index.php index.html;
log_not_found off;
error_page 404 = @drupal;
}
location @drupal {
include /etc/nginx/fastcgi_params1; # ="#QUERY_STRING…"
#fastcgi_index index.php;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param QUERY_STRING q=$request_uri;
}
location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$uri;
}

Option C - WORKING

— drupal cut here —

nginx 0.6.35 - /etc/nginx/sites-available/drupal

server {

Deny access to any host other than [www.]testsite.0

#listen 80 default;
server_name _;
return 444; # drop & do not respond
#rewrite ^(.*) http://testsite$1; # or, in [drupal]
}
server {
listen testsite:80;
server_name testsite www.testsite;

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

root /var/www/drupal;

restrict request methods to: GET, HEAD

#if ( $request_method !~ ^(GET|HEAD)$ ) {

#return 444;

deny all;

#}

hide drupal system files

location ~*
((cron.php|settings.php)|.(htaccess|engine|inc|info|install|module|profile|pl|po|sh|.sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.|Repository|Root|Tag|Template))$
{
# test with: http://testsite/scripts/drupal.sh
# test with: http://testsite/scripts/code-style.pl
# test with: http://testsite/sites/default/files/
# test with: http://testsite/sites/default/settings.php
# test with: http://testsite/sites/all/README.txt
deny all;
}

rewrite domain name without the leading www.

if ($host ~* ^www.(.)) {
# test with: http://www.testsite/
set $host_without_www $1;
# bellow $1 contains ‘/foo’, not ‘www.mydomain.com/foo
rewrite ^(.
)$ http://$host_without_www$1 permanent;
}

location / {
index index.php index.html;
# [drupal] clean url rewrite for Drupal
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
break;
}
}

location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

— drupal cut here —