Skip to content

Instantly share code, notes, and snippets.

@zevilz
Created November 7, 2019 08:56
Show Gist options
  • Save zevilz/ef6c0193293ebc11fbd159ba67c051ee to your computer and use it in GitHub Desktop.
Save zevilz/ef6c0193293ebc11fbd159ba67c051ee to your computer and use it in GitHub Desktop.
# main
location / {
index index.php;
try_files $uri $uri/ @bitrix;
}
location @bitrix {
fastcgi_pass unix:/run/php/phpX.X-fpm.$pool_name.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
fastcgi_read_timeout 180;
}
location ~* /bitrix/admin.+\.php$ {
try_files $uri @bitrixadm;
fastcgi_pass unix:/run/php/phpX.X-fpm.$pool_name.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 180;
}
location @bitrixadm {
fastcgi_pass unix:/run/php/phpX.X-fpm.$pool_name.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php;
fastcgi_read_timeout 180;
}
# security
location ^~ /bitrix/cache {
deny all;
}
location ^~ /bitrix/cache/css/ {
location ~* ^.+.(css)$ {
expires 30d;
error_page 404 /404.html;
}
location ~* .*$ {
deny all;
}
}
location ^~ /bitrix/cache/js/ {
location ~* ^.+.(js)$ {
expires 30d;
error_page 404 /404.html;
}
location ~* .*$ {
deny all;
}
}
location ~ /.git/ {
deny all;
}
location ~ /\.ht {
deny all;
}
location ~ /\.hg {
deny all;
}
location ~ /.svn/ {
deny all;
}
location ^~ /bitrix/modules/ {
deny all;
}
location ^~ /bitrix/local_cache/ {
deny all;
}
location ^~ /bitrix/stack_cache/ {
deny all;
}
location ^~ /bitrix/managed_cache/ {
deny all;
}
location ^~ /bitrix/php_interface/ {
deny all;
}
location ^~ /upload/support/not_image/ {
deny all;
}
location ~* /upload/1c_(.*)/(.*) {
deny all;
}
location ^~ /local/modules/ {
deny all;
}
location ^~ /local/php_interface/ {
deny all;
}
location ^~ /upload/ {
expires 30d;
error_page 404 /404.html;
}
location ^~ /bitrix/images/ {
expires 30d;
error_page 404 /404.html;
}
location ^~ /bitrix/tmp/ {
expires 30d;
error_page 404 /404.html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment