我正在尝试设置从 Apache 到监听端口 8000 的 Node.js/Express.js 应用程序的反向代理。此服务器已安装 cpanel,但我具有 ssh 访问权限,因此几乎忽略了 cpanel。我将以下内容添加到我的httpd.conf
.
<VirtualHost 97.74.237.44:80>
ServerName node.dealerdigitalgroup.com
ServerAlias www.node.dealerdigitalgroup.com
DocumentRoot /home/mydomain/public_html/node
UseCanonicalName Off
Options -Indexes
ProxyRequests on
ProxyPass / http://localhost:8000/
</VirtualHost>
我重新启动httpd
并启动了我的应用程序。现在,当我尝试访问时,node.dealerdigitalgroup.com
我得到了索引页,但它花费的时间比预期的要长,并且节点记录了一长串错误。
> node app.js
Listening on port 8000
GET /403.shtml 404 6.307 ms - 9
GET /403.shtml 404 1.113 ms - 9
GET /500.shtml 404 0.566 ms - 9
GET /403.shtml 404 0.266 ms - 9
GET /403.shtml 404 0.262 ms - 9
GET /403.shtml 404 0.291 ms - 9
GET /403.shtml 404 0.341 ms - 9
GET /403.shtml 404 0.863 ms - 9
GET / 200 205.543 ms - 170
GET /403.shtml 404 0.418 ms - 9
GET /403.shtml 404 0.212 ms - 9
GET /stylesheets/style.css 200 67.533 ms - 110
GET /503.shtml 404 0.366 ms - 9
GET /403.shtml 404 0.508 ms - 9
GET /403.shtml 404 0.266 ms - 9
GET /400.shtml 404 0.375 ms - 9
GET /503.shtml 404 0.500 ms - 9
GET /403.shtml 404 0.181 ms - 9
GET /403.shtml 404 0.367 ms - 9
GET /403.shtml 404 9.250 ms - 9
.....
它会一直这样下去,直到我杀死我的节点应用程序。
当我访问时,node.dealerdigitalgroup.com:8000
一切都正常运行,所以一定是 apache 的一些配置问题。
> apachectl -S
VirtualHost configuration:
127.0.0.1:80 is a NameVirtualHost
default server s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
port 80 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
127.0.0.1:443 s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1241)
97.74.237.44:443 is a NameVirtualHost
default server shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:1139)
port 443 namevhost shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:1139)
port 443 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1241)
97.74.237.44:80 is a NameVirtualHost
default server node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:27)
port 80 namevhost node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:27)
port 80 namevhost 97.74.237.44 (/usr/local/apache/conf/httpd.conf:276)
port 80 namevhost dealerdigitalgroup.net (/usr/local/apache/conf/httpd.conf:298)
port 80 namevhost dealerdigitalmarketing.com (/usr/local/apache/conf/httpd.conf:336)
port 80 namevhost dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:374)
port 80 namevhost lakeautobody.com (/usr/local/apache/conf/httpd.conf:412)
port 80 namevhost riversidedodge.com (/usr/local/apache/conf/httpd.conf:450)
port 80 namevhost shiftperformanceparts.com (/usr/local/apache/conf/httpd.conf:488)
port 80 namevhost fakedomain.com (/usr/local/apache/conf/httpd.conf:526)
port 80 namevhost theaddept.com (/usr/local/apache/conf/httpd.conf:565)
port 80 namevhost homeloansdoctor.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:603)
port 80 namevhost tradeestimator.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:641)
port 80 namevhost pedderautogroup.tradeestimator.com (/usr/local/apache/conf/httpd.conf:679)
port 80 namevhost temeculanissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:717)
port 80 namevhost cardinero.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:755)
port 80 namevhost dashboard.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:793)
port 80 namevhost racewaynissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:831)
port 80 namevhost testbuild.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:869)
port 80 namevhost peddernissan.tradeestimator.com (/usr/local/apache/conf/httpd.conf:907)
port 80 namevhost forms.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:945)
port 80 namevhost hemetcdjr.tradeestimator.com (/usr/local/apache/conf/httpd.conf:983)
port 80 namevhost lakecdjr.tradeestimator.com (/usr/local/apache/conf/httpd.conf:1021)
port 80 namevhost node.dealerdigitalgroup.com (/usr/local/apache/conf/httpd.conf:1059)
port 80 namevhost fitness19covina.dealerdigitalgroup.net (/usr/local/apache/conf/httpd.conf:1097)
port 80 namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:1191)
wildcard NameVirtualHosts and _default_ servers:
*:* is a NameVirtualHost
default server s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:288)
port * namevhost s97-74-237-44.secureserver.net (/usr/local/apache/conf/httpd.conf:288)
Syntax OK