Answer the question
In order to leave comments, you need to log in
DOCKER: Nginx + php-fpm + Bitrix24 | How to configure nginx to redirect to local push server?
I got confused with the transfer of the
Bitrix
environment to Docker and ran into the proxy setting on the Push server
. .repo: push-server-multi
Nginx built according to configuration with bitrix-env with nginx-push-stream-module and others
Services - ports:
redis: 6379
nginx: 80:80 443:443 1137-1139:1137-1139 5222 -5223:5222-5223
php-fpm: 9000
push-server: 8010-8015 8893-8895 9010-9011
Current nginx configs:
user bitrix;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240;
events {
use epoll;
worker_connections 10240;
}
http {
include /etc/nginx/mime.types;
default_type application/force-download;
server_names_hash_bucket_size 128;
# Description of supported access log formats
log_format main '$remote_addr - $remote_user [$time_local - $upstream_response_time] '
'$status "$request" $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
log_format common '$remote_addr - - [$time_local - $upstream_response_time] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" $msec';
log_format balancer '$remote_addr - $remote_user [$time_iso8601] "$host" '
'"$request" $status $body_bytes_sent "schema: $scheme" '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for" '
'"$request_length" : "$request_time" -> $upstream_response_time';
log_format debug '$upstream_response_time,"$time_local","$remote_addr","$request",$status,$body_bytes_sent';
proxy_redirect ~^http://([^:]+):443(/.+)$ https://$1$2;
include /etc/nginx/conf.d/*.conf;
# include /etc/nginx/sites-available/*.conf;
open_file_cache max=100;
}
daemon off;
server {
listen 80;
server_name sitename.ru www.sitename.ru;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
ssi on;
gzip on;
gzip_comp_level 7;
gzip_types application/x-javascript application/javascript text/css;
server_name sitename.ru www.sitename.ru;
charset off;
index index.php bitrixsetup.php;
root $root_path;
set $root_path /var/www/bitrix;
include conf.d/ssl.conf;
access_log /var/log/nginx/bitrix_access.log;
error_log /var/log/nginx/bitrix_error.log notice;
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 ~* /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;
}
client_body_buffer_size 1024m;
client_max_body_size 1024m;
}
location ~ \.php$ {
try_files $uri @bitrix;
fastcgi_pass php-upstream;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
include fastcgi_params;
}
location @bitrix {
fastcgi_pass php-upstream;
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 [email protected]";
fastcgi_param PHP_ADMIN_VALUE "session.save_path = /var/lib/php/session";
#fastcgi_param PHP_ADMIN_VALUE "soap.wsdl_cache_dir = /var/www/bitrix/bx_temp/wsdlcache";
#fastcgi_param PHP_ADMIN_VALUE "opcache.file_cache = /var/www/bitrix/bx_temp/opcache";
}
location ~* /bitrix/admin.+\.php$ {
try_files $uri @bitrixadm;
fastcgi_pass php-upstream;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
include fastcgi_params;
}
location @bitrixadm{
fastcgi_pass php-upstream;
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 [email protected]";
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# 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; }
# 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 ;
}
location ~ /.git/ {
deny all;
}
}
upstream php-upstream {
server php-fpm:9000;
}
Answer the question
In order to leave comments, you need to log in
I don't understand absolutely Nginx settings...
At the same time, you are trying to drag something into the docker :) Look here , for example. The launch option is described here just for development, which is what you want. It can be run both under Linux and via Docker Desktop + WSL2 in Windows.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question