EspoCRM with docker compose: switch from http to https and add SSL certificates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maryanp
    Junior Member
    • Jun 2024
    • 2

    EspoCRM with docker compose: switch from http to https and add SSL certificates

    Hi everyone
    I've setup Espo from official docker image (via docker-compose, with MySQL)
    Espo is working fine with http - http://mydomain.com:7070

    I am trying to switch to secure https and add SSL certs. But it doesnt work for me
    Could someone add advices or provide some short instruction how you did it.
    Thanks.

    My docker-compose.yml file

    Code:
    version: '3.8'
    
    services:
    
      mysql:
        image: mysql:8
        container_name: mysql
        environment:
          MYSQL_ROOT_PASSWORD: xxxxxx
          MYSQL_DATABASE: espocrm
          MYSQL_USER: espocrm
          MYSQL_PASSWORD: xxxxxxxx
        volumes:
          - mysql:/var/lib/mysql
        restart: always
    
      espocrm:
        image: espocrm/espocrm
        container_name: espocrm
        environment:
          ESPOCRM_DATABASE_PLATFORM: Mysql
          ESPOCRM_DATABASE_HOST: mysql
          ESPOCRM_DATABASE_USER: espocrm
          ESPOCRM_DATABASE_PASSWORD: xxxxxxx
          ESPOCRM_ADMIN_USERNAME: admin
          ESPOCRM_ADMIN_PASSWORD: xxxxxxxx
          ESPOCRM_SITE_URL: "https://mydomain.com:7080"
        volumes:
          - espocrm:/var/www/html
          - /srv/ssl/cert.cer:/etc/ssl/certs/cert.cer
          - /srv/ssl/cert.csr:/etc/ssl/certs/cert.csr
          - /srv/ssl/cert.key:/etc/ssl/certs/private/cert.key
        restart: always
        ports:
          - 7070:80
          - 7080:443
    
      espocrm-daemon:
        image: espocrm/espocrm
        container_name: espocrm-daemon
        volumes:
          - espocrm:/var/www/html
        restart: always
        entrypoint: docker-daemon.sh
    
      espocrm-websocket:
        image: espocrm/espocrm
        container_name: espocrm-websocket
        environment:
          ESPOCRM_CONFIG_USE_WEB_SOCKET: "true"
          ESPOCRM_CONFIG_WEB_SOCKET_URL: "wss://mydomain.com:7071"
          ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN: "tcp://*:7777"
          ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN: "tcp://espocrm-websocket:7777"
        volumes:
          - espocrm:/var/www/html
        restart: always
        entrypoint: docker-websocket.sh
        ports:
          - 7071:7080
    
    volumes:
      mysql:
      espocrm:​

    Running Containers:

    Click image for larger version  Name:	containers.png Views:	0 Size:	165.7 KB ID:	107705

    ports.conf

    Click image for larger version  Name:	ports.conf.png Views:	0 Size:	68.1 KB ID:	107706

    000-default.conf

    Click image for larger version  Name:	000-default.conf.png Views:	0 Size:	91.5 KB ID:	107707


    default-ssl.conf

    Click image for larger version  Name:	default-ssl.conf.png Views:	0 Size:	238.3 KB ID:	107708
    Last edited by maryanp; 06-24-2024, 03:42 PM.
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi maryanp,

    For the correct operation of EspoCRM in SSL mode and in the Docker environment, I would recommend that you use the official installation script: https://docs.espocrm.com/administrat...ls-certificate.

    Please keep in mind that this installation should be carried out on a clean server.

    Comment

    Working...