Конфиг nginx для bitrix композит
Posted: Thu Jun 30, 2016 8:08 am
Добрый день. Помогите переделать конфиг nginx для работы композита bitrix. Переписать в темплейт сам смоугу.
Вот пример конфига из документации bitrix
Конфиг vestacp
Вот пример конфига из документации bitrix
Code: Select all
#### user defined variables
# document root
root /home/bitrix/www;
# apache|php-fpm upstream
set $backend "127.0.0.1:8080";
#### /user defined variables
# default path to cache file
set $test_file "/bitrix/html_pages/$host$uri/index@$args.html";
set $storedAuth "";
set $usecache "";
# check all conditions for enable composite
if ( $http_bx_action_type = "" ) { set $usecache "A"; }
if ( $request_method = "GET" ) { set $usecache "${usecache}B"; }
if ( $cookie_BITRIX_SM_NCC = "" ) { set $usecache "${usecache}C"; }
if ( $http_x_forwarded_scheme !~ "https" ){ set $usecache "${usecache}D"; }
# IE9 and above exclude
modern_browser_value "modern";
modern_browser msie 10.0;
modern_browser unlisted;
if ($modern_browser) {
set $usecache "${usecache}E";
}
# check user auth
if ( $cookie_BITRIX_SM_LOGIN != "" ) { set $storedAuth "A"; }
if ( $cookie_BITRIX_SM_UIDH != "" ) { set $storedAuth "${storedAuth}B"; }
if ( $cookie_BITRIX_SM_CC != "Y" ) { set $storedAuth "${storedAuth}C"; }
if ( $storedAuth !~ "ABC" ) { set $usecache "${usecache}F"; }
## cache location
location ~* @.*\.html$ {
internal;
}
# use default cache file
location / {
if ($usecache != "ABCDEF" ) { proxy_pass http://$backend; }
try_files $test_file @apache;
}
# use own path to cache file: test_file
location ~* ^(.*)\.php$ {
set $test_file "/bitrix/html_pages/$host$1@$args.html";
if ($usecache != "ABCDEF" ) { proxy_pass http://$backend; }
try_files $test_file @apache;
}
# apache location
location @apache {
proxy_pass http://$backend;
}
Code: Select all
server {
listen 146.***.***.***:80;
server_name ***********.ru;
error_log /var/log/apache2/domains/**********.ru.error.log error;
location / {
proxy_pass http://146.***.***.***:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/pp/web/*******.ru/public_html;
access_log /var/log/apache2/domains/*********.ru.log combined;
access_log /var/log/apache2/domains/*************.ru.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/pp/web/************.ru/document_errors/;
}
location @fallback {
proxy_pass http://146.***.***.***:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/pp/conf/web/nginx.************.ru.conf*;
}