I've recently been porting a fairly substantial website over to a static generator from a CMS, I've wanted to maintain a commenting system on it however as it is still fairly active. So I decided to use Remark42 as its self-hosted and pretty powerful, plus still under development. One of the areas not well documented was running it on Apache without a subdomain.
I figured it would be easier to run it under a folder, and not have to worry about getting Let's Encrypt through a proxy for SSL renewals.
This guide assumes you've already got Remark42 successfully up and running on http://localhost:8080
or however you've configured it.
We're going to be installing it onto a website called example.org and running a proxy through a folder called comments
. Remark42 is configured to run with the below:
remark42.conf
:
REMARK_URL=https://www.example.org/comments
SECRET=thisismysecret
SITE=example
AUTH_ANON=true
EMOJI=true
In one of Apache's config files (it may not be called httpd.conf), we basically needed to add the location and the proxy addresses to the existing site configuration, a lot of other config has been removed in the below example, but the important parts are between the two location tags:
httpd.conf
:
<virtualhost ipaddress:443>
ServerName example.org
ServerAlias www.example.org
<location /comments/>
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</location>
</virtualhost>
That's actually enough to get it up and running, I do have mod_proxy installed in Apache. Take careful note of trailing slashes, they are important!
However the out-of-the-box /web/ does break, it references files from example.org/web/ rather than example.org/comments/web/ this only seems to effect the demo webpage however showing the behaviour below:
In a simple test page however:
This is working, with the only changes to the documentation being specifying the host and site_id.
host: "https://www.example.org/comments", // hostname of remark server, same as REMARK_URL in backend config, e.g. "https://demo.remark42.com"
site_id: 'example',
It's possible there is something else that should be configured to make the demo site work properly, but frankly it doesn't matter.
I also have not tested it extensively in a cross-domain setup, but I would likely run separate instances of Remark42 on different ports to achieve that. Now if only I could customise that date format.