因此,我尝试使用ProxyPass将node.js应用程序运行在端口3000上,也将其运行在端口80/443上。但是ProxyPass给我错误403。在我的VPS上是Apache 2.4.7。我在Internet上找到了该解决方案,因此我不确定它是否正确或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/
希望我提供了所有必要的信息。