Files
remark42/docs/subdomain.md
T
dfcf728e6f Site (#1049)
by @akellbl4 

* create infrastructure for site

* wip

* fix docker build and add readme

* add docker-compose as a build and a run method

* rename compose file yaml -> yml

* add `src` as volume for watching changes

* update configs

* update README

* add padding at the end of the pages

* move demo settings in config

* fetch latest release from github

* update docs navigation

- add sections
- redirect from root of the section to first doc
- nice styles for navigation
- add brand colors

* cache github data from first load

* add redirects and fix link to docs

* fix docs nav styles

* add installation page placeholder

* fix demo

* add 404

* add dark theme, add theme switcher, remove unused files

* fix dark theme on main page

* fix dark theme background

* fix node version

* change installation docs

* add note block

* minor fixes

* add code highlighting styles

* fixes

* fixes

* mobile navigation, fix code highlighting colors

* fix dev server

* fix fetching error

* fix path to edit

Co-authored-by: Pavel Mineev <pavel@mineev.me>
Co-authored-by: Dmitry Verkhoturov <paskal.07@gmail.com>
2021-06-13 18:44:49 -05:00

2.2 KiB

title
title
Subdomain

How to configure remark42 without a subdomain

All README examples show configurations with remark42 on its own subdomain, i.e. https://remark42.example.com. However, it is possible and sometimes desirable to run remark42 without a subdomain, but just under some path, i.e. https://example.com/remark42.

  • The frontend URL looks like this: s.src = 'https://example.com/remark42/web/embed.js;

  • The backend REMARK_URL parameter will be https://example.com/remark42

  • And you also need to slightly modify the callback URL for the social media login API's:

    • Facebook Valid OAuth Redirect URIs: https://example.com/remark42/auth/facebook/callback
    • Google Authorized redirect URIs: https://example.com/remark42/auth/google/callback
    • GitHub Authorised callback URL: https://example.com/remark42/auth/github/callback

docker-compose configuration

Both Nginx and Caddy configuration below relies on remark42 available on hostname remark42, which is achieved by having container_name: remark42 in docker-compose.

Example docker-compose.yaml:

version: '2'
services:
  remark42:
    image: umputun/remark42:latest
    container_name: remark42
    restart: always
    environment:
      - REMARK_URL=https://example.com/remark42/
      - SITE=<site_ID>
      - SECRET=<secret>
      - ADMIN_SHARED_ID=<shared_id>
    volumes:
      - ./data:/srv/var
    logging:
      options:
        max-size: '10m'
        max-file: '1'

Nginx configuration

The nginx.conf would then look something like:

  location /remark42/ {
    rewrite /remark42/(.*) /$1 break;
    proxy_pass http://remark42:8080/; // use internal docker name of remark42 container for proxy
    proxy_set_header Host $http_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;
  }

Caddy configuration

Example of Caddy configuration (Caddyfile) running remark42 service on example.com/remark42/:

example.com {
	gzip
	tls mail@example.com

	root /srv/www
	log  /logs/access.log

	# remark42
	proxy /remark42/ http://remark42:8080/ {
		without /remark42
		transparent
	}
}