Помощь что не так с правилами для nginix (прошу подсказать)?

lightman555

Гуру форума
Регистрация
7 Мар 2013
Сообщения
375
Реакции
65
Раньше сайт был на апач + php
Перевел на nginix

И обнаружил, что запросы выглядят по разному
в одном случае
nginix
Для просмотра ссылки Войди или Зарегистрируйся

на апач + php
он иной

Для просмотра ссылки Войди или Зарегистрируйся

то есть разница
#/page-2
и
?p=2

как сделать чтобы работало правильно?

видимо из-за этой причины не работает правильно сортировка по имени
должно быть так
Для просмотра ссылки Войди или Зарегистрируйся

в итоге сбрасывается и не показывается ничего
помогите разобраться пожалуйста
 
Пробуй
Код:
server {


    server_name xxx.com   www.xxx.com;


    access_log /var/log/nginx/xxx.com.access.log rt_cache;
    error_log /var/log/nginx/xxx.com.error.log;


    root /var/www/xxx.com/htdocs;
   
   

    index index.php index.html index.htm;

   
   
    include /var/www/xxx.com/conf/nginx/*.conf;


    # [REQUIRED EDIT IF MULTILANG]
    rewrite ^/fr$ /fr/ redirect;
    rewrite ^/fr/(.*) /$1;

    rewrite ^/en$ /en/ redirect;
    rewrite ^/en/(.*) /$1;

    rewrite ^/qc$ /qc/ redirect;
    rewrite ^/qc/(.*) /$1;

location / {
  index /index.php;
    # Global rewrite not depending on languages
  rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

  rewrite "^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/(.*)\.jpg$" /img/c/$1$2.jpg last;
  rewrite "^/c/([_a-zA-Z-]+)/(.*)\.jpg$" /img/c/$1.jpg last;

  rewrite "^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/(\P{M}\p{M}*)*\.jpg$" /img/p/$1-$2$3.jpg last;
  rewrite "^/([0-9]+)\-([0-9]+)/(\P{M}\p{M}*)*\.jpg$" /img/p/$1-$2.jpg last;
  rewrite "^/([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$1$2.jpg last;
  rewrite "^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$1$2$3.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$1$2$3$4.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
  rewrite "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$" /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;

  rewrite "^/([0-9]+)\-(\P{M}\p{M}*)+\.html(.*)$" /index.php?controller=product&id_product=$1$3 last;
  rewrite "^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=category&id_category=$1$3 last;
  rewrite "^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$" /index.php?controller=product&id_product=$2$4 last;
  rewrite "^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$" /index.php?controller=supplier&id_supplier=$1$3 last;
  rewrite "^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$" /index.php?controller=manufacturer&id_manufacturer=$1$3 last;
  rewrite "^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms=$1$3 last;
  rewrite "^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms_category=$1$3 last;
  rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

  rewrite ^/page-not-found$ /index.php?controller=404 last;
  rewrite ^/address$ /index.php?controller=address last; 
  rewrite ^/addresses$ /index.php?controller=addresses last;
  rewrite ^/authentication$ /index.php?controller=authentication last;
  rewrite ^/best-sales$ /index.php?controller=best-sales last;
  rewrite ^/cart$ /index.php?controller=cart last;
  rewrite ^/contact-us$ /index.php?controller=contact-form last;
  rewrite ^/discount$ /index.php?controller=discount last;
  rewrite ^/guest-tracking$ /index.php?controller=guest-tracking last;
  rewrite ^/order-history$ /index.php?controller=history last;
  rewrite ^/identity$ /index.php?controller=identity last;
  rewrite ^/manufacturers$ /index.php?controller=manufacturer last;
  rewrite ^/my-account$ /index.php?controller=my-account last;
  rewrite ^/new-products$ /index.php?controller=new-products last;
  rewrite ^/order$ /index.php?controller=order last;
  rewrite ^/order-follow$ /index.php?controller=order-follow last;
  rewrite ^/quick-order$ /index.php?controller=order-opc last;
  rewrite ^/order-slip$ /index.php?controller=order-slip last;
  rewrite ^/password-recovery$ /index.php?controller=password last;
  rewrite ^/prices-drop$ /index.php?controller=prices-drop last; 
  rewrite ^/search$ /index.php?controller=search last;
  rewrite ^/sitemap$ /index.php?controller=sitemap last;
  rewrite ^/stores$ /index.php?controller=stores last; 
  rewrite ^/supplier$ /index.php?controller=supplier last;
  rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;

  try_files $uri $uri/ /index.php?$args;
}


location /mymultistorename/ {
  rewrite ^/mymultistorename/(.*)$ /$1 last;
  try_files $uri $uri/ /index.php?$args;
}


    location /admin-dev/ {
        if (!-e $request_filename) {
            rewrite ^/.*$ /admin-dev/index.php last;
        }
    }

# PHP FPM part
    location ~ \.php$ {
        # Verify that the file exists, redirect to index if not
        try_files $fastcgi_script_name /index.php$uri&$args =404;

        fastcgi_index  index.php;

        # Environment variables for PHP
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        include       fastcgi_params;

        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        # [REQUIRED EDIT] Connection to PHP-FPM - choose one
        # fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass unix:/var/run/php7.0-fpm.sock;

        fastcgi_keep_conn on;
        fastcgi_read_timeout 30s;
        fastcgi_send_timeout 30s;

        # In case of long loading or 502 / 504 errors
        # fastcgi_buffer_size 256k;
        # fastcgi_buffers 256 16k;
        # fastcgi_busy_buffers_size 256k;
        client_max_body_size 10M;
    }

}
 

Не "кисло" - у меня гораздо по проще и у меня на сервере 2-е версии 1.4 (с которой сложности) и 1.6
правила разные
для 1.4 побольше (но я так и не понял где в них создается запрос на пагинацию)

rewrite ^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg last;
rewrite ^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$1$2.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$ /img/c/$1.jpg last;
rewrite ^/c/([0-9]+)/[a-zA-Z0-9-]+\.jpg$ /img/c/$1.jpg last;
rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last;
rewrite ^/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 last;
rewrite ^/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$1 last;
rewrite ^/([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 last;
rewrite ^/([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 last;

#rewrite ^/([0-9]+)_.([a-zA-Z0-9-]*) /$1_ permanent;
#rewrite ^/([0-9]+)_$ /manufacturer.php?id_manufacturer=$1 last;

rewrite ^/0_ /manufacturers permanent;
rewrite ^/([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 last;

rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 last;
rewrite ^/content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 last;
rewrite ^/page-not-found$ /404.php last;
rewrite ^/address$ /address.php last;
rewrite ^/addresses$ /addresses.php last;
rewrite ^/authentication$ /authentication.php last;
rewrite ^/best-sales$ /best-sales.php last;
rewrite ^/cart$ /cart.php last;
rewrite ^/contacts$ /contact-form.php last;
rewrite ^/discount$ /discount.php last;
rewrite ^/guest-tracking$ /guest-tracking.php last;
rewrite ^/order-history$ /history.php last;
rewrite ^/identity$ /identity.php last;
rewrite ^/manufacturers$ /manufacturer.php last;
rewrite ^/my-account$ /my-account.php last;
rewrite ^/new-products$ /new-products.php last;
rewrite ^/order$ /order.php last;
rewrite ^/order-follow$ /order-follow.php last;
rewrite ^/quick-order$ /order-opc.php last;
rewrite ^/order-slip$ /order-slip.php last;
rewrite ^/password-recovery$ /password.php last;
rewrite ^/prices-drop$ /prices-drop.php last;
rewrite ^/search$ /search.php last;
rewrite ^/sitemap$ /sitemap.php last;
rewrite ^/stores$ /stores.php last;
rewrite ^/supplier$ /supplier.php last;
rewrite ^/registraciya$ /register.php last;
rewrite ^/feedback$ /feedback.php last;
rewrite ^/imgs/([a-zA-Z0-9\/-_.]+)$ /get.php?src=$1 last;

rewrite ^/blog/$ /modules/newscore/news.php last;
rewrite ^/blog/entry/([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ /modules/newscore/news.php?id_entry=$1 last;
rewrite ^/blog/category/([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ /modules/newscore/news.php?category_id=$1 last;
rewrite ^/blog/category/([0-9]+)-([a-zA-Z0-9-]*)/entry/([0-9]+)-([a-zA-Z0-9-]*)(.*)$ "/modules/newscore/news.php?category_id=$1&id;_entry=$3" last;

error_page 404 /404.php;
 
нашел в чем причина - оказалось в фильтре товаров :)
 
Подскажите пожалуйста почему ошибка при добавлении файл Sitemap в гугл и яндекс возникает:
"файл Sitemap является страницей HTML
Проверьте файл с помощью Яндекса: Для просмотра ссылки Войди или Зарегистрируйся (зайти в раздел Инструменты — Анализ файлов Sitemap).
Что пишет?
 
Какой текст нужно указывать, подскажите ?
 
Назад
Сверху