Files
hrbox-helm-chart/.helm/templates/01-nginx-configmap.yaml
T
2026-09-05 19:07:31 +06:00

226 lines
6.9 KiB
YAML

---
apiVersion: v1
kind: ConfigMap
metadata:
name: web-configuration
labels:
{{- include "hrbox.labels" (dict "ctx" . "name" "web") | nindent 4 }}
data:
nginx.conf: |
user www-data;
worker_processes 6;
pid /run/nginx.pid;
events {
worker_connections 10000;
use epoll;
multi_accept on;
}
http {
set_real_ip_from 10.0.0.0/8;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 0;
types_hash_max_size 2048;
server_tokens off;
limit_conn_zone $binary_remote_addr zone=addr:10m;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
client_body_buffer_size 1024k;
client_max_body_size 20m;
client_header_buffer_size 1024k;
large_client_header_buffers 16 1024k;
default_type application/octet-stream;
include /etc/nginx/mime.types;
##
# SSL Settings
##
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
server {
listen 80 default;
server_name _ ;
root /app/web;
index index.php;
keepalive_timeout 70;
client_body_temp_path /nginx-tmp 1 2;
client_body_timeout 22s;
client_header_timeout 22s;
limit_conn addr 10000;
location ~ /\.(git) {
deny all;
}
location = /healthz {
access_log off;
return 200 "ok\n";
}
location = /health-check {
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 1s;
fastcgi_read_timeout 3s;
fastcgi_send_timeout 1s;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param PATH_INFO /health-check;
}
location = /api/v1/integration/commit {
client_max_body_size 500m;
fastcgi_request_buffering off;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
include fastcgi_params;
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_connect_timeout 60s;
}
location /.well-known/assetlinks.json {
default_type "application/json";
alias /var/www/assetlinks/assetlinks.json;
}
location /.well-known/apple-app-site-association {
default_type "application/json";
alias /var/www/assetlinks/apple-app-site-association;
}
location = /frontend/sw.js {
add_header Service-Worker-Allowed /;
add_header Cache-Control "no-cache, must-revalidate, public";
expires off;
try_files $uri $uri/ /index.php?$args;
access_log off;
}
location ^~ /ai/ {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header Permissions-Policy "browsing-topics=()" always;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
include fastcgi_params;
fastcgi_read_timeout 300s;
fastcgi_connect_timeout 60s;
fastcgi_send_timeout 60s;
}
location / {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header Permissions-Policy "browsing-topics=()" always;
try_files $uri $uri/ /index.php?$args;
location ~* \.(js|css|png|jpg|gif|ico)$ {
expires 30d;
add_header Vary Accept-Encoding;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
tcp_nodelay off;
try_files $uri $uri/ /index.php?$args;
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
location ~* \.(woff|woff2|ttf|otf|eot)$ {
expires 30d;
add_header Vary Accept-Encoding;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
try_files $uri $uri/ /index.php?$args;
}
}
location ~ \.php$ {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 20s;
fastcgi_connect_timeout 60s;
fastcgi_send_timeout 60s;
}
}
}