Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Apache ReverseProxy不使用节点和SSL_Node.js_Apache_Reverse Proxy - Fatal编程技术网

Node.js Apache ReverseProxy不使用节点和SSL

Node.js Apache ReverseProxy不使用节点和SSL,node.js,apache,reverse-proxy,Node.js,Apache,Reverse Proxy,我正在尝试在web服务器上的HTTPS上设置我的应用程序。我有一个使用AutoSL安装在InMotion主机上的有效证书。我的节点应用程序在Centos服务器上的端口3000上运行,apache SSL服务器在端口443上运行。为了将请求路由到我的网站,我正在尝试创建反向代理。我制作了一个名为default site.conf的文件,该文件存储在/etc/http.d/conf.d中,包含以下内容: <VirtualHost _default_:443> SSLProxyEn

我正在尝试在web服务器上的HTTPS上设置我的应用程序。我有一个使用AutoSL安装在InMotion主机上的有效证书。我的节点应用程序在Centos服务器上的端口3000上运行,apache SSL服务器在端口443上运行。为了将请求路由到我的网站,我正在尝试创建反向代理。我制作了一个名为
default site.conf
的文件,该文件存储在
/etc/http.d/conf.d
中,包含以下内容:

<VirtualHost _default_:443>
    SSLProxyEngine on

    ServerName example.com
    ServerAlias www.example.com 

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia Full
    <Proxy *>
      Require all granted
    </Proxy>

    ServerAdmin info@example.com
    DocumentRoot /home/USER/my-app/public

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLCertificateFile  /home/USER/ssl/certs/certificate.crt
    SSLCertificateKeyFile /home/USER/ssl/keys/certificate.key


    ProxyPass / https://example.com:3000/
    ProxyPassReverse / https://example.com:3000 /

    <Directory "/home/USER/my-app/public">
        AllowOverride All
    </Directory>        

</VirtualHost>

SSLProxyEngine打开
ServerName example.com
ServerAlias www.example.com
代理请求关闭
代理主机
ProxyVia Full
要求所有授权
服务器管理员info@example.com
DocumentRoot/home/USER/my-app/public
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
SSLCertificateFile/home/USER/ssl/certs/certificate.crt
SSLCertificateKeyFile/home/USER/ssl/keys/certificate.key
ProxyPass/https://example.com:3000/
ProxyPassReverse/https://example.com:3000 /
允许超越所有
我要强调的是,该应用程序可在
http://example.com:3000
(不安全)但当我尝试转到
https://example.com
(安全)我得到一个404错误的空白index.html:


[错误]加载资源失败:服务器响应状态为404(未找到)(index.js,第0行)

我通过将配置完全简化为以下两行来解决此问题:

ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

这可能不是最灵活的方法,但它会按照我需要的方式重新路由流量,因此出于我的目的,它可以工作。

那么端口3000上的节点应用程序不提供HTTPS服务,而是HTTP服务?也许您想将代理传递(反向)到
http://example:3000/
而不是
https://example:3000/
此外,节点应用程序是否与Apache服务器在同一台机器上运行,还是在另一台主机上运行?如果它位于同一主机上,则可能会绑定到
http://localhost:3000
而不是
http://example.com:3000
,这取决于它的设置方式。我以前在http上有过它。两者都在同一台计算机上运行。如果代理传递到
http://
,错误是否相同?如果您只是在节点应用程序上记录所有请求,那么当您向
https://example.com
?没关系。。。我只是说去他妈的,ProxyPassed没有虚拟主机。