我在使用 Mercure 的 Apache 服务器上有一个 Symfony 项目,我尝试在生产环境中设置 Mercure hub。
为了在生产环境中运行 Mercure hub,我将存档 mercure_0.6.2_Linux_x86_64.tar.gz ( https://github.com/dunglas/mercure/releases ) 提取到我项目根目录下的子文件夹 mercure 中。
然后我运行命令:
JWT_KEY='myJWTKey' ACME_HOSTS='example.com' ./mercure
我的信息
但集线器没有运行并出现此错误:
FATA[0000] listen tcp :443: bind: permission denied
我看到了一个类似的问题 ( How to run Mercure in production ) 但是建议的答案使用 ADDR 来更改端口,并且根据文档,“Let's Encrypt 仅支持默认端口:要使用 Let's Encrypt,请勿设置此变量。”。
如何在生产环境中运行 Mercure?
最佳答案
以下是我为解决问题所做的步骤:
我用这个命令运行 Mercure:
JWT_KEY='aVerySecretKey' ADDR='myhub.com:3000' CORS_ALLOWED_ORIGINS='https://mywebsite.com' DEBUG=1 ALLOW_ANONYMOUS=1 ./mercure
因此,Mercure 在这里运行:http://myhub.com:3000 .
我使用 Apache 作为具有以下参数的代理:
ProxyPass / http://myhub.com:3000/
ProxyPassReverse / https://myhub.com/
现在,我可以在此处通过 HTTPS 访问集线器 https://myhub.com/hub来 self 的域 https://mywebsite.com .
感谢 Mercure 的作者 dunglas。
关于apache - 如何使用 Apache 在生产环境中运行 Mercure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57704453/