500 error appears with urls like /mypath?utm_source... or /search?q=xxx... and trying to open links with gotwo module redirects (links like /go/link_id).

My nginx configuration file:

server {
    listen       80;
    server_name  www.site.ru;
    return       301 http://site.ru$request_uri;
}
server {
  listen 80 default_server;
  server_name site.ru;
  root /var/www/html/drupal;
  index index.php index.html index.htm;
  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
      root /usr/share/nginx/html;
  }
  location = /favicon.ico {
    log_not_found off;
    access_log off;
   }
   location = /robots.txt {
     allow all;
     log_not_found off;
     access_log off;
   }
   location ~ \..*/.*\.php$ {
     return 403;
   }
   location ~ ^/sites/.*/private/ {
     return 403;
   }
   location ~ (^|/)\. {
     return 403;
   }
   location @rewrite {
     rewrite ^ /index.php;
   }
   location ~ \.php$ {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME $request_filename;
     fastcgi_intercept_errors off;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
   }
   location ~ ^/sites/.*/files/styles/ {
     try_files $uri @rewrite;
   }
   location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
     expires max;
     log_not_found off;
   }
   ##### BOOST #####
        location / {
                try_files $uri @boost;
        }
        location @boost {
                if ($http_cookie ~ "DRUPAL_UID" ) {
                        return 405;
                }
                                if ($request_method !~ ^(GET|HEAD)$ ) {
                                                return 405;
                                }
                if ($request_method = "POST" ) {
                        return 405;
                }
                error_page 405 = @drupal;
                add_header Expires "Sun, 19 Nov 1978 05:00:00 GMT";
                add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
                try_files /cache/normal/$host${uri}_$args.html /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;

        }

        ##### BOOST END #####

}

Any idea?

Comments

kaztur created an issue. See original summary.

kaztur’s picture

Status: Active » Closed (fixed)

Working config:

server {
    listen       80;
    server_name  www.site.ru;
    return       301 http://site.ru$request_uri;
}

server {
  listen 80 default_server;
  server_name site.ru;

  root /var/www/html/drupal;
  index index.php index.html index.htm;

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
      root /usr/share/nginx/html;
  }

  location = /favicon.ico {
    log_not_found off;
    access_log off;
   }

   location = /robots.txt {
     allow all;
     log_not_found off;
     access_log off;
   }

   location ~ \..*/.*\.php$ {
     return 403;
   }

   location ~ ^/sites/.*/private/ {
     return 403;
   }

   location ~ (^|/)\. {
     return 403;
   }
   
location / {
    try_files           $uri    @cache;
}

location @cache {
    if ($http_cookie ~ "DRUPAL_UID") { return 405; }
    if ($request_method !~ ^(GET|HEAD)$ ) { return 405; }
    error_page 405 = @drupal;
    add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
    add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
    try_files /cache/normal/$host/${uri}_${args}.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
}

location @drupal {
    rewrite ^/(.*)$ /index.php?q=$1;
}

location @rewrite {
    rewrite ^/(.*)$ /index.php?q=$1;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
}

   location ~ \.php$ {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME $request_filename;
     fastcgi_intercept_errors off;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
   }

   location ~ ^/sites/.*/files/styles/ {
     try_files $uri @rewrite;
   }
}