我有一个CentOS 6 VPS与Apache使用端口80来托管我的一些网站。但是,我的一个网站现在要求Node.js用于其中一个功能,但是运行Node脚本证明相当困难,因为我希望它在端口80上运行,但apache2目前正在使用它。这是根据下面的错误。
错误:听EADDRINUSE:地址已在使用0.0.0.0:80
我的网站域名是new.johnsykesfoundation.org。它不是我的cPanel的默认域,并嵌套在public_html / xxxxxx中。我在我的httpd.conf
文件中实现了以下内容,但仍然无法正常工作。我必须遗漏一些东西。
<VirtualHost *:80>
ServerName new.johnsykesfoundation.org
ProxyPreserveHost on
ProxyPass /home/jscuizj1n8m0/public_html/newjsf
<Location "/charge">
ProxyPreserveHost On
ProxyPass http://localhost:3000/charge
ProxyPassReverse http://localhost:3000/charge
</Location>
</VirtualHost>
mod_proxy
也启用了。
发布于 2019-06-05 11:40:12
一个起点是添加一个位置条目来使用proxypass指令:
<Location "/external/url/to/node/service/">
ProxyPreserveHost On
ProxyPass http://localhost:10000/internal/url/
ProxyPassReverse http://localhost:10000/internal/url/
</Location>
#/external/url/to/node/serivce/
# This is the url connecting clients will access through apache.
# It ca be what ever you like. So for example people will access:
# http://www.yourdomain.org/mynodeservice
# in a browser this will actually access the node service
#ProxyPass http://localhost:10000/
# ^ ^
# host port
# running node
# node is listening on
#
# This sets up the proxy to forward the request above to this host and location.
我在此示例中使用了端口10000,但您需要选择一个适合您的设置。注意结束斜杠在Location
和ProxyPass
指令中很重要。结帐https://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypass
也许这有效:
<VirtualHost *:80>
ServerName new.johnsykesfoundation.org
ProxyPreserveHost on
ProxyPass /home/jscuizj1n8m0/public_html/newjsf
<Location "http://new.johnsykesfoundation.org/charge">
ProxyPreserveHost On
AllowMethods POST GET
Require all granted
ProxyPass http://localhost:3000/charge
ProxyPassReverse http://localhost:3000/charge
</Location>
</VirtualHost>
https://stackoverflow.com/questions/-100006926
复制相似问题