@maxyc_webber
Web-программист

Nginx-boilerplate. Как настроить pretty urls для CMS MadeSimple?

Использую https://github.com/Umkus/nginx-boilerplate

Для работы ЧПУ нужно настроить мод реврайт. Но у меня настроен nGinx + php5-fpm
Прошу помощи настроить ЧПУ

Что должно отрабатывать: wiki.cmsmadesimple.fr/wiki/Pretty_Url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule XXX_regex index.php?page=$1 [QSA]

Мои настройки nginx
listen                  80;

#listen                  443 ssl;
#include                 nginx-bp/enable/ssl.conf;
#ssl_certificate         /etc/nginx/certs/server.crt;
#ssl_certificate_key     /etc/nginx/certs/server.key;

# Allow uploads?
client_max_body_size    5M;

# Gzip compression?
include                 nginx-bp/enable/gzip.conf;
gzip_comp_level         9;

# Protect system files?
include                 nginx-bp/locations/system.conf;

# Restricted access?
#allow   127.0.0.1;
#deny    all;

location @php
{
    # PHP enabled?
    include                 nginx-bp/enable/php.conf;


    # Use this instead if Php is off
    #return 405;

    #Php caching
    #include                nginx-bp/enable/php_cache.conf;
    fastcgi_cache_valid    200 301 302 304 1h;
    fastcgi_cache_min_uses 3;

    #Php request limiting?
    #limit_req               zone=reqPerSec30 burst=1000 nodelay;
    #limit_conn              conPerIp 30;
}

location ~ ^.+\.php(?:/.*)?$
{
    try_files !noop! @php;
}

# Use custom error pages?
#fastcgi_intercept_errors   on;
#include                nginx-bp/locations/errors.conf;
#error_page             404 /404.html;
#error_page             500 501 502 503 504 /50x.html;

# Allowed methods
if ($request_method !~ ^(OPTIONS|GET|HEAD|POST)$ ) {
    return              405;
}

# Log bots?
access_log              /var/log/nginx/locahost.bots.log main if=$bot_ua;

# Log humans?
access_log              /var/log/nginx/locahost.access.log main if=!$bot_ua;

# Error logging
error_log               /var/log/nginx/locahost.error.log error;

# Static requests limiting
#limit_req               zone=reqPerSec30 burst=1000 nodelay;
#limit_conn              conPerIp 30;

# Seconds to wait for backend to generate a page
fastcgi_read_timeout    1024;

# Default location /
include                 nginx-bp/locations/default.conf;

# Handle static files
include                 nginx-bp/locations/static.conf;
  • Вопрос задан
  • 2580 просмотров
Решения вопроса 1
@maxyc_webber Автор вопроса
Web-программист
Починил.
Отключаем

# Default location /
include                 nginx-bp/locations/default.conf;

Добавляем

location /{
        try_files $uri $uri/ /index.php?page=$request_uri;
}
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы