node.js app stalls in vhost context

having some trouble proxying a node application via vhosts and would greatly appreciate any help:

my app works fine if i run node /usr/local/lsws/fcgi-bin/lsnode.js from the bash prompt, whether as root or the owner of the app. i can curl it just fine. but if i have it setup as a vhost context config, it just hangs—timeout error.

vhost conf:

context /api {
type appserver
location /home/
binPath /bin/node
appType node
maxConns 100

rewrite {

addDefaultCharset off


Request Timeout
This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase ‘Connection Timeout’.

and the error log:

2020-04-07 03:37:27.849954 [NOTICE] [LocalWorker::workerExec] suExec check uid 99 gid 99 setuidmode 0.
2020-04-07 03:37:27.849984 [NOTICE] [LocalWorker::workerExec] Config[]: suExec uid 99 gid 99 cmd /bin/node /usr/local/lsws/fcgi-bin/lsnode.js, final uid 99 gid 99.
2020-04-07 03:37:27.851083 [NOTICE] [] add child process pid: 66195.
GET /api/add HTTP/1.1
Connection: keep-alive
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36 Edg/80.0.361.109
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip
Accept-Language: en-US,en;q=0.9
Cookie: __cfduid=d0eaf6bdad767429fcbd638800e26ad131586216468
X-Forwarded-For: XX.XX.XX.XX

2020-04-07 03:37:29.066219 [INFO] Process with PID: 66195 is dead
2020-04-07 03:42:28.726306 [INFO] [] Connection idle time too long: 301 while in state: 6 watching for event: 0, close!
2020-04-07 03:42:28.726355 [INFO] [XX.XX.XX.XX:33308] Content len: 0, Request line:
GET /api/add HTTP/1.1
2020-04-07 03:42:28.726362 [INFO] [] HttpExtConnector state: 8, request body sent: 0, response body size: -2, response body sent:0, left in buffer: 0, attempts: 0.
2020-04-07 03:42:28.726369 [INFO] [] Proxy connection state: 2, watching event: 25, Request header:599, body:0, sent:0, Response header: 0, total: 0 bytes received in 301 seconds,Total processing time: 301.
2020-04-07 03:47:29.066920 [NOTICE] [] stop worker processes

@selfagency I know your post was pretty long ago, but could you solve your issue? I have the same problem now and I don’t know why. I am trying to host my node/nestjs application but only get timeouts.

This can help to set up reverse proxy.

Hi @usmannasir,
thank you for posting the link. I followed all the instructions but still, I can’t get it running.

This is my vHost:

extprocessor staging {
type proxy
maxConns 100
env NODE_ENV=production
initTimeout 60
retryTimeout 60
respBuffer 0

context / {
type appserver
location /home/
binPath /usr/bin/node
appType node
startupFile main.js
maxConns 100

rewrite {

addDefaultCharset off

My Rewrite rules:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^(.)$ http://postgres/$1 [P] #postgres docker container
RewriteRule ^/(.
)$ http://staging/$1 [P,]

When I run the node command “node dist/apps/exampleapp/main” via ssh it works:
[NestApplication] Nest application successfully started +22ms

but I still get a timeout when I open in my browser.

Thank you for your help in advance!


I forgot to mention that http://[IP-ADDRESS]:[PORT] is working perfectly
and I fixed one typo:
RewriteRule ^/(.)$ http://staging/$1 [P,]
RewriteRule ^/(.
)$ http://staging/$1 [P,]

but still not working :frowning:

No one with ideas what I could try?

Now I am facing the same problem for the Next JS application in ubuntu (cyberpanel). But in cent os + cyberpanel working fine