I have a Symfony project on an Apache server that uses Mercure and I try to setup the Mercure hub in production.
To run the Mercure hub in production, I extract the archive mercure_0.6.2_Linux_x86_64.tar.gz (https://github.com/dunglas/mercure/releases) into a subfolder mercure at the root of my project.
Then I run the command:
JWT_KEY='myJWTKey' ACME_HOSTS='example.com' ./mercure
with my informations
But the hub doesn’t run with this error:
FATA[0000] listen tcp :443: bind: permission denied
I saw a similar question (How to run Mercure in production)
but the proposed answer uses ADDR to change port, and according to the documentation, “Let’s Encrypt only supports the default port: to use Let’s Encrypt, do not set this variable.”.
How do I run Mercure in production?
2
Answers
Here are the steps I did to resolve my problem :
I run Mercure with this command:
So, Mercure run here: http://myhub.com:3000.
I use Apache as a proxy with this parameters:
So now, I can access the hub in HTTPS here https://myhub.com/hub from my domain https://mywebsite.com.
Thanks to dunglas, the author of Mercure.
I don’t know if this is helpful, but after a lot of struggle I got Mercure working on a live server like this. (I’m using port 9090 throughout.) In Apache domain conf:
In Javascript:
In Symfony:
Being careful not to confuse MERCURE_JWT_TOKEN with MERCURE_JWT_SECRET.
From root, running Mercure server like this for testing:
So now everything is working, without https / 443 problems.