drupal & nginx

Главные вкладки

Аватар пользователя KaMaToZzz KaMaToZzz 23 ноября 2010 в 12:50

Проблема с друпалом, при переходе на http://fun.viks.net.ua/admin/settings/cf_webchat (к примеру), протсо белый лист, жму обновить страницу, страница загружается норм, короче с первого раза, не срабатывает.
Как быть, кто подскажет?
конфиг nginx:

location / {
root /www/;
index index.php index.html index.htm;
if (!-e $request_filename ) {
rewrite ^(.*)$ /index.php?q=$1;
}
}

# php
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/$fastcgi_script_name;
include fastcgi_params;
}

Комментарии

Аватар пользователя vgoodvin vgoodvin 23 ноября 2010 в 13:16

Последний это рабочий пример. Копипаст не приветствуется. Лучше изучить директивы. Читайте доки по энжи они же на русском.

Аватар пользователя KaMaToZzz KaMaToZzz 23 ноября 2010 в 19:07

подскажите пожалуйста, где ошибка?
так как заходя на сайт без добавления index.php белый лист, а если с index.php то открывается главня страница.
Конфиги выше не помогли, вот мои конфиги:

   server {
        listen 80;
        server_name fun.viks.net.ua;

        access_log /var/log/nginx/example.access_log main;
        error_log /var/log/nginx/example.error_log info;

        root /www;

        ## www. redirect
        if ($host ~* ^(www\.)(.+)) {
          set $rawdomain $2;
          rewrite ^/(.*)$  http://$rawdomain/$1 permanent;
        }

        ## 6.x starts
        location / {
          #rewrite ^/(.*)/$ /$1 permanent; # remove trailing slashes - disabled
          try_files $uri [user=cache]cache[/user];
        }

        location [user=cache]cache[/user] {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }

          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=drupal]drupal[/user];

          add_header Expires epoch;
          add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
          try_files /cache/normal/$host${uri}_$args.html [user=drupal]drupal[/user];
        }

        location [user=www]www[/user] {
          ###
          ### now simplified to reduce rewrites
          ###
          rewrite ^/(.*)$  /index.php?q=$1 last;
        }

        location ~* (/\..*|settings\.php$|\.(htaccess|engine|inc|info|ini|install|module|profile|pl|po|pot|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(Entries.*|Repository|Root|Tag|Template))$ {
          deny all;
        }

        location ~* /files/.*\.php$ {
          return 444;
        }
        location ~* /themes/.*\.php$ {
          return 444;
        }

        location ~* \.php$ {
          try_files $uri [user=www]www[/user];       #check for existence of php file
          fastcgi_pass          unix:/tmp/php-fpm.sock;
          fastcgi_index         index.php;
          fastcgi_param         SCRIPT_FILENAME /www/$fastcgi_script_name;
          include               fastcgi_params;                                
        }                                                                      

        location ~ \.css$ {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }
          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=uncached]uncached[/user];
          access_log  off;
          expires  max; #if using aggregator
          try_files /cache/perm/$host${uri}_.css $uri =404;
        }

        location ~ \.js$ {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }
          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=uncached]uncached[/user];
          access_log  off;
          expires  max; #if using aggregator
          try_files /cache/perm/$host${uri}_.js $uri =404;
        }

        location ~ \.json$ {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }
          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=uncached]uncached[/user];
          access_log  off;
          expires  max; #if using aggregator
          try_files /cache/normal/$host${uri}_.json $uri =404;
        }

        location [user=uncached]uncached[/user] {
          access_log  off;
          expires  max; # max if using aggregator, otherwise sane expire time
        }

        location ~* /files/imagecache/ {
          access_log         off;
          try_files $uri [user=drupal]drupal[/user];  #imagecache support - now it works
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
          access_log      off;
          expires         30d;
          try_files $uri =404;
        }

        location ~* \.xml$ {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }
          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=drupal]drupal[/user];
          add_header Expires epoch;
          add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
          types { }
          default_type application/rss+xml;
          try_files /cache/normal/$host${uri}_.xml /cache/normal/$host${uri}_.html $uri [user=drupal]drupal[/user];
        }

        location ~* /feed$ {
          if ( $request_method !~ ^(GET|HEAD)$ ) {
            return 405;
          }
          if ($http_cookie ~ "DRUPAL_UID") {
            return 405;
          }

          error_page 405 = [user=drupal]drupal[/user];
          add_header Expires epoch;
          add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
          types { }
          default_type application/rss+xml;
          try_files /cache/normal/$host${uri}_.xml /cache/normal/$host${uri}_.html $uri [user=drupal]drupal[/user];
        }

    } # end of server

Аватар пользователя KaMaToZzz KaMaToZzz 23 ноября 2010 в 20:47

взял конфиг drupal.ru
все равно если вводить логин при входе, первый раз после нажатия на кнопку будет белая страница, нажимаешь f5 и все приходит в норму...

Аватар пользователя andribas@drupal.org andribas@drupal.org 23 ноября 2010 в 20:55

"KaMaToZzz" wrote:
от туда и брал вот этот http://drupal.ru/files/nginx.tgz[/quote]
вообще там еще настройки кой-какие в nginx.conf, в частности index index.php, и дальше идет include hosts/example.ru
а остальное в hosts/
и количество worker_processes поставьте сколько ядер,
worker_rlimit_nofile=8192, т.к. по умолчанию 32к нет, надо sysctl править

Аватар пользователя KaMaToZzz KaMaToZzz 25 ноября 2010 в 10:18

Блин ну ничего не выходит, я даже статью не могу удалить, белый лист, обновляю страницу, статья по прежнему есть.... Ну кто нибудь помогите!!!

Аватар пользователя KaMaToZzz KaMaToZzz 25 ноября 2010 в 11:16

Вопрос такой, а если выключены ссылки как уазаны тут /index.php?q=$1 , а включены типо /chat/ /news/ должен ли быть вот такой конфиг или строка rewrite будет иметь другое значение?

        location / {
            root   /path/to/drupal;
            index  index.php index.html;

            if (!-f $request_filename) {
                rewrite  ^(.*)$  /index.php?q=$1  last;
                break;
            }

            if (!-d $request_filename) {
                rewrite  ^(.*)$  /index.php?q=$1  last;
                break;
            }

        }

Аватар пользователя KaMaToZzz KaMaToZzz 26 декабря 2010 в 20:43

со временем появилась другая беда.
по любым ссылкам ходить можно, а вот по /admin пишет что болт 404 - not found

а вот на /chat или /webcams спокойно заходит...

Что это такое может быть?