How to setup Remark42 with Docker


Remark42 is a self-hosted, lightweight, and simple (yet functional) comment engine, which doesn't spy on users. It can be embedded into blogs, articles or any other place where readers add comments.

This tutorial will walk you through setting up Remark42 on Ubuntu with Apache2 and Docker.


  • Apache2
  • Docker

If you haven't install Docker

sudo snap install docker

Install Remark42 with Docker

Official Guide:

Copy provided docker-compose.yml and customize for your needs. You can create a folder first and paste the docker-compose.yml inside the folder. Source:

Here is my docker-compose.yml.

version: '2'

        build: .
        image: umputun/remark42:latest
        container_name: "remark42"
        restart: always

            driver: json-file
                max-size: "10m"
                max-file: "5"

          - "8888:8080"

            - REMARK_URL=
            - SITE=tatlead
            - SECRET=*******
            - STORE_BOLT_PATH=/srv/var/db
            - BACKUP_PATH=/srv/var/backup
            - DEBUG=true
            - AUTH_GOOGLE_CID
            - AUTH_GOOGLE_CSEC
            - AUTH_GITHUB_CID=*******
            - AUTH_GITHUB_CSEC=*******
            - AUTH_FACEBOOK_CID
            - AUTH_FACEBOOK_CSEC
            - AUTH_DISQUS_CID
            - AUTH_DISQUS_CSEC
            - ADMIN_SHARED_ID
            # - ADMIN_PASSWD=password
            - ./var:/srv/var

Pull the umputun/remark42:latest image from the DockerHub

docker-compose pull


docker-compose up -d

Your remark42 server is running on 👏

Setup Apache2 reverse proxy

Goto /etc/apache2/sites-enabled/, create or edit a .conf file. We will create the file on this example.

sudo nano remark42.conf

My .conf settings

<VirtualHost *:443>

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all

    Header unset X-Frame-Options
    Header edit Set-Cookie ^(XSRF-TOKEN=.*);.?[h|H].+(;.*)$ "$1$2"

    ProxyPass /
    ProxyPassReverse /    

    SSLEngine on
    SSLProxyEngine On
    Include *******
    SSLCertificateFile *******
    SSLCertificateKeyFile *******

Header unset X-Frame-Options is set because X-Frame-Options is default to SAMEORIGIN. Unset the X-Frame-Options allows the remark42 widget iframe display on all sites. You should set the docker-compose.yml's ALLOWED_HOSTS environment variable to restrict the allowed hosts instead.

Header edit Set-Cookie ^(XSRF-TOKEN=.*);.?[h|H].+(;.*)$ "$1$2" is a line to remove the HttpOnly attribute on the XSRF-TOKEN cookie. In my case, XSRF-TOKEN cookie is always set to HttpOnly (not sure why), it causes remark42 cannot read the xsrf token properly and cause xsrf mismatch error. If you doesn't have this issue, you may remove this line.

ProxyPass and ProxyPassReverse should be point to the remark42 server which is in this example.

Restart Apache2

Restart apache2 to apply the changes

sudo service apache2 restart

Visit https://<your_remark42_domain>/web on your browser to check it works or not.
Working Example:

Setup remark42 on Hexo Aomori Theme (Bonus)

Base on

Edit the _config.yml, the site_id should be the same as the value on the docker-compose.yml's SITE environment variable.

  enable: true
  site_id: tatlead
  max_shown_comments: 10
  theme: light
  locale: en
  show_email_subscription: false

本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可。