我正在尝试让 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/