ЧПУ в nginx php-fpm в server

listen 188.112.121.100:80;
    location / {
        try_files $uri $uri/ @handler;
        location ~ [^/]\.ph(p\d*|tml)$ {
            try_files /does_not_exists @php;
        }
    }
    location @handler {
        rewrite ^(.*) /index.php?$1 last;
    }

    location @php {
        fastcgi_index index.php;
        fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@example.ru";
        fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
        fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
        try_files $uri =404;
        include fastcgi_params;
    }


Редирект на https
return 301 https://$host:443$request_uri;

Сжатие - кэширование
    gzip on;
    gzip_comp_level 3;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    expires 8d;

2 комментария:

  1. можно проще

    location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
    try_files /does_not_exists @php;
    }
    # Enable joomla SEF URL's inside Nginx
    try_files $uri $uri/ /index.php?$args;
    }

    ОтветитьУдалить