fix .gitignore dir negation so config/ and scripts/ are tracked

This commit is contained in:
infra-bot
2026-08-27 16:14:23 +03:00
parent e14bfc676f
commit 34ff3a2693
19 changed files with 460 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# Bot detection maps. Empty deny lists = fully inert.
# Add an entry only for agents that can never be a real visitor.
# Rejected bots ($bad_agent) are a HINT passed to PHP via fastcgi_param
# (add `fastcgi_param BITRIX_BOT $bad_agent;` in the snippet if you use it);
# denied ones never reach PHP.
map $http_user_agent $bad_agent {
default 0;
#~*(semrush|ahrefs|mj12bot) 1;
}
map $http_user_agent $denied_agent {
default 0;
~*YandexRenderResourcesBot 1; # known page-render crawler storm
#~*(other-bot-pattern) 1;
}
map $remote_addr $denied_ip {
default 0;
#203.0.113.66 1;
#198.51.100.0/24 1;
}
map $http_referer $bad_referer {
default 0;
}
+54
View File
@@ -0,0 +1,54 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log warn;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 2048;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Standard combined-style format: CrowdSec parses it out of the box.
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
types_hash_max_size 2048;
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 60;
client_body_timeout 60;
send_timeout 60;
open_file_cache max=10000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
gzip on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_vary on;
gzip_types text/plain text/css text/xml application/json application/javascript
application/x-javascript image/svg+xml application/rss+xml text/xml+rss;
reset_timedout_connection on;
# Zone defined here, enforced per-location where needed:
limit_req_zone $binary_remote_addr zone=main_limit:10m rate=10r/s;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
+49
View File
@@ -0,0 +1,49 @@
server {
listen 80;
listen [::]:80;
server_name __DOMAIN__ www.__DOMAIN__;
root /home/bitrix/www;
index index.php index.html;
charset utf-8;
# ---- hard denies (order matters: regex locations match top-down) ----
location ~ /\. { deny all; } # dotfiles (.htaccess, .git...)
location ~* ^/(bitrix|local)/modules/.*\.php$ { deny all; } # no direct module execution
location ~* ^/upload/.*\.(php|phar|phtml)$ { deny all; } # uploads must never execute
# ---- static assets straight from disk, no PHP ----
location ~* ^.+\.(jpg|jpeg|gif|png|webp|avif|svg|ico|css|js|woff|woff2|ttf|eot|otf|mp3|mp4|m4a|ogg|pdf|zip|csv|xlsx?)$ {
expires 7d;
add_header Cache-Control "public";
access_log off;
try_files $uri =404;
}
# ---- optional rate-limit example zone (uncomment when needed) ----
#location /search {
# limit_req zone=main_limit burst=20 nodelay;
# rewrite ^(.*)$ /search/index.php last;
#}
# ---- Bitrix SEF routing (official pattern) ----
location / {
index index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /bitrix/urlrewrite.php last;
}
}
# ---- PHP execution ----
location ~ \.php$ {
include snippets/fastcgi-bitrix.conf;
}
# security headers (TLS versions added by certbot block later)
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options SAMEORIGIN always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
}
# certbot --nginx will extend this file with the :443 server block,
# redirect 80->443 and ACME challenge handling automatically.
+10
View File
@@ -0,0 +1,10 @@
fastcgi_pass unix:/run/php/bitrix-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 16 32k;
fastcgi_hide_header X-Powered-By;