bitrix24 + nginx + php-fpm

Битрикс шмитрикс, та еще головная боль. Но бизнес требует что бы проект был на битриксе, а ставить их битриксвм у меня нет никакого желания. Дело не в том что там центос, а в том, что они держат конфиги в каком-то извращенном виде (имхо). Да и своих приколов там хватает, в виде того что не всегда получается пуш сервис для портала. Потому решение всё делать на своей сборке. Точнее на любой другой.

Ставим nginx и php нужных версий.

И делаем конфиг для виртуального хоста в nginx


server { listen 127.0.0.1:8895 default_server; server_name www.site.ru; access_log /var/log/nginx/rtc.log; add_header "X-Content-Type-Options" "nosniff"; location /bitrix/pub/ { # IM doesn't wait proxy_ignore_client_abort on; proxy_pass http://nodejs_pub; } location / { deny all; } } # Push/sub server upstream nodejs_sub { ip_hash; keepalive 1024; server 127.0.0.1:8010; server 127.0.0.1:8011; server 127.0.0.1:8012; server 127.0.0.1:8013; server 127.0.0.1:8014; server 127.0.0.1:8015; } # Push/pub server upstream nodejs_pub { ip_hash; keepalive 1024; server 127.0.0.1:9010; server 127.0.0.1:9011; } # if connection ti not set map $http_upgrade $connection_upgrade { default upgrade; '' 'close'; } map $http_upgrade $replace_upgrade { default $http_upgrade; '' "websocket"; } server { listen 80; server_name www.site.ru; location / { return 301 https://$server_name$request_uri; } } server { listen 443 ssl; ssl_certificate /etc/nginx/ssl/crt.ru.crt; ssl_certificate_key /etc/nginx/ssl/key.ru_private.key; server_name www.site.ru; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_comp_level 7; gzip_types application/x-javascript application/javascript text/css; charset off; #disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /home/bitrix/www; set $php_sock unix:/run/php/php7.4-fpm-bitrix.sock; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; location / { try_files $uri $uri/ @bitrix; } location ~* ^/bitrix/subws/ { access_log /var/log/nginx/im_access.log json; error_log /var/log/nginx/im_error.log warn; proxy_pass http://nodejs_sub; # http://blog.martinfjordvald.com/2013/02/websockets-in-nginx/ # 12h+0.5 proxy_max_temp_file_size 0; proxy_read_timeout 43800; proxy_http_version 1.1; proxy_set_header Upgrade $replace_upgrade; proxy_set_header Connection $connection_upgrade; } location ~* ^/bitrix/sub/ { access_log /var/log/nginx/im_access.log json; error_log /var/log/nginx/im_error.log warn; rewrite ^/bitrix/sub/(.*)$ /bitrix/subws/$1 break; proxy_pass http://nodejs_sub; proxy_max_temp_file_size 0; proxy_read_timeout 43800; } location ~* ^/bitrix/rest/ { access_log /var/log/nginx/im_access.log json; error_log /var/log/nginx/im_error.log warn; proxy_pass http://nodejs_pub; proxy_max_temp_file_size 0; proxy_read_timeout 43800; } location ~* /upload/.*\.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)$ { types { text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht py psp rb var; } } location ~ \.php$ { try_files $uri @bitrix; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; } location @bitrix { fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; }location ~* /bitrix/admin.+\.php$ { try_files $uri @bitrixadm; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; } location @bitrixadm{ fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } ## block this locations for any installation# # ht(passwd|access) location ~* /\.ht { deny all; } # repositories location ~* /\.(svn|hg|git) { deny all; } # bitrix internal locations location ~* ^/bitrix/(modules|local_cache|stack_cache|managed_cache|php_interface) { deny all; } # upload files location ~* ^/upload/1c_[^/]+/ { deny all; } # use the file system to access files outside the site (cache) location ~* /\.\./ { deny all; } location ~* ^/bitrix/html_pages/\.config\.php { deny all; } location ~* ^/bitrix/html_pages/\.enabled { deny all; } # Intenal locations location ^~ /upload/support/not_image { internal; } # Cache location: composite and general site location ~* @.*\.html$ { internal; # disable browser cache, php manage file expires -1y; add_header X-Bitrix-Composite "Nginx (file)"; } # Player options, disable no-sniff location ~* ^/bitrix/components/bitrix/player/mediaplayer/player$ { add_header Access-Control-Allow-Origin *; } # Accept access for merged css and js location ~* ^/bitrix/cache/(css/.+\.css|js/.+\.js)$ { expires 30d; error_page 404 /404.html; } # Disable access for other assets in cache location location ~* ^/bitrix/cache { deny all; } # Use nginx to return static content from s3 cloud storage # /upload/bx_cloud_upload/<schema>.<backet_name>.<s3_point>.amazonaws.com/<path/to/file> location ^~ /upload/bx_cloud_upload/ { location ~ ^/upload/bx_cloud_upload/(http[s]?)\.([^/:]+)\.(s3|s3-us-west-1|s3-eu-west-1|s3-ap-southeast-1|s3-ap-northeast-1)\.amazonaws\.com/(.+)$ { internal; resolver 8.8.8.8; proxy_method GET; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Server $host; #proxy_max_temp_file_size 0; proxy_pass $1://$2.$3.amazonaws.com/$4; } location ~* .*$ { deny all; } } # Static content location ~* ^/(upload|bitrix/images|bitrix/tmp) { expires 30d;} location ~* \.(css|js|gif|png|jpg|jpeg|ico|ogg|ttf|woff|eot|otf)$ { error_page 404 /404.html; expires 30d; } location = /404.html { access_log off ; }

}

 

Корпоративный почтовый сервер на минималках (postfix + dovecot + freeipa)

Postfix — агент передачи почты (MTA — mail transfer agent). Postfix является свободным программным обеспечением, создавался как альтернатива Sendmail.
Изначально Postfix …

bitrix24 + nginx + php-fpm

Битрикс шмитрикс, та еще головная боль. Но бизнес требует что бы проект был на битриксе, а ставить их битриксвм у …

Настрока фаервола nftables

nftables — подсистема ядра Linux, обеспечивающая фильтрацию и классификацию сетевых пакетов/датаграмм/кадров. Включена в ядро Linux, начиная с версии 3.13, выпущенной …

PostgreSQL master slave репликация