node.js - ProxyPass apache https 到 Node 服务器

标签 node.js apache reverse-proxy mod-proxy http-proxy

我正在尝试让 apache 服务器成为我的 Node 服务器的网关。
我的 apache 将提供静态页面, Node 将充当 rest api 服务器。
Node 和 apache 都位于同一台服务器上,ubuntu 64 位 ec2。

我曾尝试为 https 执行此操作但失败了,后来我尝试为代理通行证打开一个 http 端口并且它起作用了(我已将 Node 更改为 http 以便它起作用) .

我的最后一招是将 Node 转到 Web 服务器,但我希望保持简单,因为它将很快进行重构并使用 meteor 。

我会很感激任何建议

这是我的apache配置

<VirtualHost *:443>

    ServerName secure.mysite.co.il
    ServerAdmin admin@mysite.com
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on
    SSLCertificateFile /ssl/mysite.crt
    SSLCertificateKeyFile /ssl/mysite.key
    SSLCertificateChainFile /ssl/ca-bundle-client.crt

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /echo/test https://127.0.0.1:8001/echo/test
    ProxyPassReverse /echo/test https://127.0.0.1:8001/echo/test

http配置成功

<VirtualHost *:80>
    ServerAdmin admin@mysite.com
    ServerName mysite.co.il
    ServerAlias www.mysite.co.il
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://127.0.0.1:8001/
    ProxyPassReverse / http://127.0.0.1:8001/
</VirtualHost>

最佳答案

需要声明 SSLProxyEngine On 才能为反向代理配置启用 SSL。该指令记录在此处:

http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslproxyengine

关于node.js - ProxyPass apache https 到 Node 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34865193/

相关文章:

node.js - 谷歌云发布订阅 : Previously valid subscription suddenly unauthorized

windows - 是否有下载 ab Apache 基准测试的链接

html - 使用 htaccess 修复拼写错误的网址

apache2 - 尝试更改 reverse_proxy 上的缓存 header

caching - LB服务器下的varnish

ruby-on-rails - 将 apache SSL 反向代理与 Rails 应用程序结合使用

node.js - SNS confirmSubscription 使用 NodeJs 和 Express

node.js - mongodb 在使用数字进行文本搜索时性能不佳

javascript - 如何在Javascript中只保留字符串中的双引号部分?

Apache ACE 与 Apache Felix 一起嵌入在 Tomcat 中?