如何解决nodejs通过带有letsencrypt的apache反向代理
我的目标是在带有 letencrypt 的 debian 10 上通过 apache2 上的反向代理设置 nodejs 服务器。我在其他 2 个子域 api.my_server.com 和 ng.my_server.com 上通过 letencrypt 和 apache2 设置了一个 API 和一个角度服务器,没有问题。 sudo certbot --apache -d ng.my_server.com
没有问题。
现在反向代理不允许我使用letsencrypt 创建证书。我试过 sudo certbot --apache -d auth.my_server.com
我有 Challenge failed for domain auth.my_server.com
。我手动尝试了 sudo certbot certonly --manual -d auth.my_server.com
,但遇到了一个问题,据我所知,它试图将一个文件设置到 .well-known/acme-challenge/
中,但似乎不起作用。
nodejs.conf
<VirtualHost *:80>
ServerName auth.my_server.com
ServerAdmin me@something.com
ErrorLog ${APACHE_LOG_DIR}/error.auth.my.log
CustomLog ${APACHE_LOG_DIR}/access.auth.my.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.auth.my_server.com [OR]
RewriteCond %{SERVER_NAME} =auth.my_server.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
nodejs-ssl.conf
<VirtualHost *:443>
ServerName auth.my_server.com
ServerAdmin me@something.com
ErrorLog ${APACHE_LOG_DIR}/error.auth.my.log
CustomLog ${APACHE_LOG_DIR}/access.auth.my.log combined
ProxyPass /.well-known !
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
ProxyPreserveHost On
</VirtualHost>
这样做的正确方法是什么?我尝试使用 pm2 并在本地使用我的端口 3000
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。