Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

У вас nginx, проксирует запросы к апачу или нет. Если проксирует,то настройки не должны ничем существенным отличаться.

нету апача
Link to comment
Share on other sites


location / {
  if (!-e $request_filename){
	rewrite ^(.*)$ /index.php?_route_=$1 break;
  }
}

Это в локейшене сайта прописывать или ngninx.conf?

Если сайта

Там уже есть location PHP в него добавить или ниже дописать?

Link to comment
Share on other sites


если прописывать в локейшене сайта ваш конфигн, то seo страницы начинают не отображатся а запускаются как файл.

Нашел код

"rewrite ^/(.+)$ /index.php?_route_=$1 last;" он отлично работает, за исключением очень большого минуса, перестает заходить админка, как с этим боротся?

ЗЫ у меня нет окончания на страницах .html если это важно.

Link to comment
Share on other sites


Nginx без Апача. Каждый должен делать свое дело. Апач обрабатывать динамику, Nginx - статику.

Почему? Насколько я понял в высоконагруженных платформах апач не используется ведь?
Link to comment
Share on other sites


Да, скорее всего не используется, но те кто использует не задает такие вопросы как Вы, а довольствуется связкой NGINX(фронтенд)+Apache(бекенд) и это достаточно за глаза.

Link to comment
Share on other sites

Теперь новые грабли, более интересные.

Если задать seo имя в категории и не задать его в подкатегории то эта подкатегория не открывается.

Это особенность движка или это бага?

Link to comment
Share on other sites


Все логично. Ссылки строятся по порядку с соблюдением иерархии. Если категория с ЧПУ а подкатегория нет, то что прикажете сделать скрипту? Отсюда и неработоспособность.

Link to comment
Share on other sites

Вот не помню где нарыл, пачка сайтов крутится без проблем с такими конфигами.

server {
	listen 80;
	server_name sait.com www.sait.com;
	root /home/pashast/sait.com;
	access_log /var/log/nginx/sait.com.access.log;
	error_log  /var/log/nginx/sait.com.error.log error;
	index index.php;
location / { try_files $uri @opencart; }

location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }

location ~ /.ht { deny all; }

location ~* (.(tpl|ini))$ { deny all; }

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

location /admin { index index.php; }
location ~* .(js|css|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ {
  add_header Pragma "public";
  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
	 access_log off;
	 log_not_found off;
	 expires   90d;
}
  
location ~* .(jpg|jpeg|gif|css|png)$ {
access_log off;
expires 10d;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/pashast/sait.com$fastcgi_script_name;
include fastcgi_params;
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_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

Вот не помню где нарыл, пачка сайтов крутится без проблем с такими конфигами.

Спасибо большое, с вашим конфигом заработало все,

Использую Ubuntu 12.04+nginx+PHP FPM на DigitalOcean

Link to comment
Share on other sites

  • 2 months later...
  • 5 months later...
if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?_route_=$1 last; }

Зачем это условие нужно? 

 

Если выше в конфиге уже есть конструкция:

location / { try_files $uri @opencart; }

       location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }
Link to comment
Share on other sites


if (!-e $request_filename)
чтобы ваши реальные файлы не полетели вслед за редиректом.

Так директива try_files как раз и проверяет существует ли запрашиваемый файл, если нет тогда идет редирект. Или я что не так понимаю, объясните поподробнее, можно даже с примерами думаю будет многим полезно. Не судите строго я в этом новичок. :unsure:

Данный вопрос возник, когда понадобилось подключить модуль google sitemap и прописать в конфиге рерайт с /sitemap.xml на /index.php?route=feed/google_sitemap

На что данный if не давал возможности осуществить правильный редирект, хотя было прописано явно:

location = /sitemap.xml {rewrite ^/(.+)$ /index.php?route=feed/google_sitemap last;}
Link to comment
Share on other sites


  • 6 months later...

админка так и не грузится, может кто подскажет что вставить и куда?

сео работает

 

стоит убунту 14 nginx + ispConfig3 

Апача нету

 

конфиг:

server {
        listen *:80;


        server_name cr.com www.cr.com;

        root   /var/www/cr.com/web;



        index index.html index.htm index.php index.cgi index.pl index.xhtml;



        error_page 400 /error/400.html;
        error_page 401 /error/401.html;
        error_page 403 /error/403.html;
        error_page 404 /error/404.html;
        error_page 405 /error/405.html;
        error_page 500 /error/500.html;
        error_page 502 /error/502.html;
        error_page 503 /error/503.html;
        recursive_error_pages on;
        location = /error/400.html {

            internal;
        }
location / { try_files $uri @opencart; }

location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }

location ~ /\.ht { deny all; }

location ~* (\.(tpl|ini))$ { deny all; }

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

location /admin { index index.php; }
location ~* .(js|css|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ {
  add_header Pragma "public";
  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
	 access_log off;
	 log_not_found off;
	 expires   90d;
}
  
location ~* .(jpg|jpeg|gif|css|png)$ {
access_log off;
expires 10d;
}

        location = /error/401.html {

            internal;
        }
        location = /error/403.html {

            internal;
        }
        location = /error/404.html {

            internal;
        }
        location = /error/405.html {

            internal;
        }
        location = /error/500.html {

            internal;
        }
        location = /error/502.html {

            internal;
        }
        location = /error/503.html {

            internal;
        }

        error_log /var/log/ispconfig/httpd/cr.com/error.log;
        access_log /var/log/ispconfig/httpd/cr.com/access.log combined;

        location ~ /\. {
            deny all;
            access_log off;
            log_not_found off;
        }

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

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

        location /stats/ {

            index index.html index.php;
            auth_basic "Members Only";
            auth_basic_user_file /var/www/clients/client0/web1/web/stats/.htpasswd_stats;
        }

        location ^~ /awstats-icon {
            alias /usr/share/awstats/icon;
        }

        location ~ \.php$ {
            try_files /6a5333782f654bb3be0c8f68623c5721.htm @php;

        }

        location @php {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;


        }







}
Edited by zoolos
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.