所以我尝试使用ProxyPass让端口3000上运行的node.js应用程序也在端口80/443上 . 但是ProxyPass给了我错误403.在我的VPS上是Apache 2.4.7 . 我在互联网上找到了这个解决方案,所以我不确定它是否正确或者是否在Apache配置中存在问题 . 此外,还启用了模块proxy和proxy_http . 我的000-default.conf:
<VirtualHost *:80>
ServerName socket.example.com
DocumentRoot /var/www/stats/
Options -Indexes
ErrorDocument 503 /check.html
<Directory /var/www/socket/>
Options MultiViews FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ProxyRequests on
ProxyPass /check.html !
ProxyPass / http://stats.example.com:3000/
ProxyPassReverse / http://stats.example.com:3000/
</VirtualHost>
#This just serve to user index.html where js connect to socket.io using port 3000
<VirtualHost *:80>
ServerName stats.example.com
#Redirect / https://stats.example.com/
DocumentRoot /var/www/stats
<Directory /var/www/stats/>
Options MultiViews FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
这是我在error.log中得到的错误:
[Sat Jul 14 22:51:44.269152 2018] [authz_core:error] [pid 5496] [client xxx.xxx.xxx.xxx:xxxxx] AH01630: client denied by server configuration: proxy:http://stats.example.com:3000/
希望我提供了所有必要的信息 .