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?
Here are the steps I did to resolve my problem :
I run Mercure with this command:
JWT_KEY='aVerySecretKey' ADDR='myhub.com:3000' CORS_ALLOWED_ORIGINS='https://mywebsite.com' DEBUG=1 ALLOW_ANONYMOUS=1 ./mercure
So, Mercure run here: http://myhub.com:3000.
I use Apache as a proxy with this parameters:
ProxyPass / http://myhub.com:3000/
ProxyPassReverse / https://myhub.com/
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.