在Apache 2.4服务器的子域上运行Node js应用程序

我正在尝试在端口8000上运行Node js应用程序,并将Apache 2.4.7代理服务器的子域添加到localhost上的该端口。 我可以使用一个虚拟主机,使用如下所示的启用站点的conf文件,将节点应用程序作为一个页面( http://example.com/nodeapp )提供:

<VirtualHost *:80> ServerName example.com ServerAlias "www.example.com" DocumentRoot "/var/www/html" ProxyPass "/nodeapp" "http://localhost:8000/" </VirtualHost> 

然而,我真正想要做的是节点应用程序运行在一个子域,如http://nodeapp.example.com ,这是我有麻烦的地方。 我已经尝试了一些不同的configuration与单个和多个VirtualHosts,但这是我现在的样子:

 <VirtualHost nodeapp.example.com:80> ServerName "nodeapp.example.com" # ProxyPreserveHost On ProxyPass "/" "http://localhost:8000/" # ProxyPassReverse "/" "http://localhost:8000/" </VirtualHost> <VirtualHost *:80> ServerName example.com ServerAlias "www.example.com" DocumentRoot "/var/www/html" </VirtualHost> 

这是基于这里提出的问题:
使用Apache VirtualHost访问同一台服务器上的Node JS实例

但是,当我去的子域(我在GoDaddy上设置只是转发到同一个服务器的IP地址),我只是得到一个超时,如果我看在Apache错误日志中,我看到一些行,如:

 [Tue Mar 29 04:53:56.909467 2016] [core:notice] [pid 15912] AH00094: Command line: '/usr/sbin/apache2' [Tue Mar 29 04:56:33.332390 2016] [proxy:error] [pid 15917] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8000 (localhost) failed [Tue Mar 29 04:56:33.332441 2016] [proxy:error] [pid 15917] AH00959: ap_proxy_connect_backend disabling worker for (localhost) for 60s 

我真的不知道我在哪里出错,但任何帮助将不胜感激!

这是我使用的:

 <VirtualHost *:80> ServerAdmin [email protected] ServerName sub.example.com DocumentRoot /var/www/html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error-sub.example.com.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access-sub.example.com.log combined # sub: ProxyPreserveHost On ProxyRequests Off ProxyPass / http://example.com:8000/ ProxyPassReverse / http://example.com:8000/ </VirtualHost>