location / { try_files $uri $uri/ /bitrix/urlrewrite.php$is_args$args; }
if ($request_uri ~ ^(.*)/index.(html|php)) { return 301 $1/$is_args$args; }
server { listen 80; server_name site.ru; root /var/www/site.ru/; index index.php; location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } if ($request_uri ~ ^(.*)/index.(html|php)) { return 301 $1/$is_args$args; } location / { try_files $uri $uri/ /bitrix/urlrewrite.php$is_args$args; } location ~* @.*\.html$ { internal; } }
location ~ \.php$ { location ~* /\.\./ { internal; } location ~ /\.[^/]+$ { internal; } location ~* ^/upload/1c_[^/]+/ { internal; } location ~* ^/(bitrix/(cache|images|tmp)|upload)/ { internal; } location ~* ^/bitrix/(footer|header|license_key)\.php$ { internal; } location ~* ^/(bitrix|local)/components/(.*)/(.*)/(class|component)\.php$ { internal; } location ~* ^/(bitrix|local)/(backup|blocks|bx_cloud_upload|local_cache|module|modules|managed_cache|php_interface|public|stack_cache)/ { internal; } include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } location ~* \.(hg|svn|git|bzr)$ { internal; } location ~* /\.\./ { internal; } location ~* @.*\.html$ { internal; } location / { location ~* ^/(bitrix|local)/(backup|blocks|bx_cloud_upload|local_cache|module|modules|managed_cache|php_interface|public|services|stack_cache)/ { internal; } location ~ /\.[^/]+$ { internal; } location ~* ^/upload/1c_[^/]+/ { internal; } try_files $uri $uri/ /bitrix/urlrewrite.php$is_args$args; }
location ~* \.(jpg|jpeg|png|tiff|gif|webp|xml|html|yml|ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|rtf|pdf|txt|js|css|bmp|pnm|pbm|ppm)$ { access_log off; expires 97d; }
modern_browser_value "modern"; modern_browser msie 10.0; modern_browser unlisted; map "$cookie_BITRIX_SM_LOGIN:$cookie_BITRIX_SM_UIDH:$cookie_BITRIX_SM_CC" $storedAuth { default ""; "~*:*:Y" ""; "~*:*:*" 1; "~*:*:" 1; } map "$request_method:$http_bx_action_type:$cookie_BITRIX_SM_NCC:$http_x_forwarded_scheme:$modern_browser:$storedAuth" $usecache { default "1"; "~GET:::*https*" "1"; "~GET:::*:*:" ""; }
set $i "index@"; location / { try_files /bitrix/html_pages/$host$uri$i${args}.html$usecache /bitrix/html_pages/$host$uri$i${args}=.html$usecache /bitrix/html_pages/$host$uri/$i${args}.html$usecache /bitrix/html_pages/$host$uri/$i${args}=.html$usecache $uri $uri/ /bitrix/urlrewrite.php$is_args$args; }
server { listen 80; server_name site.ru; root /var/www/site.ru/; index index.php; location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } if ($request_uri ~ ^(.*)/index.(html|php)) { return 301 $1/$is_args$args; } set $i "index@"; location / { try_files /bitrix/html_pages/$host$uri$i${args}.html$usecache /bitrix/html_pages/$host$uri$i${args}=.html$usecache /bitrix/html_pages/$host$uri/$i${args}.html$usecache /bitrix/html_pages/$host$uri/$i${args}=.html$usecache $uri $uri/ /bitrix/urlrewrite.php$is_args$args; } location ~* @.*\.html$ { internal; } }
Source: https://habr.com/ru/post/438604/