@ktonado

Что изменить в конфиге nginx для битрикса, чтобы работал ЧПУ?

server
{
listen 80;
server_name dev.stealth.ru;
charset utf-8;
allow all;

location / {
try_files $uri $uri/ @bitrix;
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; }
}

set $hosts dev.stealth.ru;

set $root_path /home/mg/hosts/dev.stealth.ru/public;
set $app_root /home/mg/hosts/dev.stealth.ru/public;

index index.php;
root $root_path;

access_log /home/mg/logs/dev.stealth.ru/access_dev.log;
error_log /home/mg/logs/dev.stealth.ru/error_dev.log;

# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $host;

client_max_body_size 1024M;
client_body_buffer_size 4M;

# if ($host = 'www.test.ru' ) {
# rewrite ^(.*)$ http://test.ru$1 permanent;
# }

location ~* /upload/.*\.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)$ {
types {
text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht py psp rb var;
}
}

location ~ \.php$ {
try_files $uri @bitrix;

fastcgi_intercept_errors On;
fastcgi_connect_timeout 60;
fastcgi_read_timeout 60;
fastcgi_pass mg;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru";
include fastcgi_params;
}
location @bitrix {
fastcgi_pass mg;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
# fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru";
}
location ~* /bitrix/admin.+\.php$ {
try_files $uri @bitrixadm;
fastcgi_pass mg;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru";
include fastcgi_params;
}
location @bitrixadm{
fastcgi_pass mg;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php;
# fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru";
}

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

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
}
  • Вопрос задан
  • 606 просмотров
Пригласить эксперта
Ответы на вопрос 1
Stargot
@Stargot
Just Do It
Попробуйте

location / {        
        index  index.php;
        try_files $uri $uri/ /index.php?$args;      
    }
Ответ написан
Ваш ответ на вопрос

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

Похожие вопросы
23 нояб. 2024, в 00:16
2000 руб./за проект
22 нояб. 2024, в 23:55
3000 руб./за проект
22 нояб. 2024, в 22:26
3500 руб./за проект