Задать вопрос
@Stiffyx

Как настроить локальный Bitrix и почтовый сервер на одном IP с помощью Nginx (на Windows)?

Есть сервер. Один статический IP. Две виртуальные машины. На одной BitrixVM, на второй - почтовый сервер. Есть задача, чтобы по адресу crm.bitrix.com извне открывался битрикс, а по адресу mail.com открывался веб-интерфейс почтового сервера.

Установил Nginx на Windows системе, пробросил порты, запускаю Nginx. Вроде всё работает несколько минут, но потом в веб-интерфейсе битрикса пишет "Отсутствует соединение с сервером". При этом, всё открываются, сообщения в чате приходят. Почтовый сервер тоже работает. Но почему появляется сообщение "Отсутствует соединение с сервером"? Конфигурация Nginx ниже.

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

Q
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    #keepalive_timeout  0;
    keepalive_timeout  70;

    # Enable Gzip compression
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    # SSL settings
    ssl_certificate      c:\Nginx\certs\mycert.pem; # Update with your SSL certificate path
    ssl_certificate_key  c:\Nginx\certs\mycert2.pem;    # Update with your SSL key path
    ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;        # Adjust protocols as needed
    ssl_ciphers          HIGH:!aNULL:!MD5;

    # Server block for HTTPS
    server {
        listen       443 ssl;
        server_name  crm.bitrix.com; # Replace with your domain

        # Location block to handle all requests
        location / {
            # Reverse proxy configuration
            proxy_pass https://bitrix.local; # Replace with your backend server address
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }

    server {
        listen       443 ssl;
        server_name  mail.com; # Replace with your domain

        # Location block to handle all requests
        location / {
            # Reverse proxy configuration
            proxy_pass https://mail.local; # Replace with your backend server address
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }

    # Server block for HTTP to redirect to HTTPS
    server {
        listen      80;
        server_name bitrix.local; # Replace with your domain
        return      301 https://$host$request_uri;
    }

    server {
        listen      80;
        server_name mail.local; # Replace with your domain
        return      301 https://$host$request_uri;
    }

}


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
  • Вопрос задан
  • 142 просмотра
Подписаться 1 Простой 4 комментария
Решения вопроса 1
@Drno
Первая ошибка - ставить софт предназначенный для сети или веб сервера на винду…

Поднимите виртуалку на убунте, настройте там nginx. Дальше пусть он разруливает что и куда
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
proxy_pass https://bitrix.local; # Replace with your backend server address


вряд ли у виртуалок есть сертификаты, поэтому http
Bitrix не работает потому, что ему нужен более сложный конфиг, посмотрите как это сделано в BitrixVM
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы