K
K
ktonado2017-08-28 09:53:09
Nginx
ktonado, 2017-08-28 09:53:09

What to change in the nginx config for Bitrix to make the CNC work?

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 [email protected]";
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 [email protected]";
}
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 [email protected]";
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 [email protected]";
}
location = /favicon.ico {
log_not_found off;
access_logoff;
}
location = /robots.txt {
allow all;
log_not_found off;
access_logoff;
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stargot, 2017-08-29
@Stargot

Try

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question