• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Node.js support

MeekSqueek

New Pleskian
Hi all,

I have attempted to use the interface to enable node support on a website. I have followed the help pages but I am unable to get the application to work - even if it is a simple hello world. I have tested the application by calling node directly and it works fine.

I set the application root, application start-up file and enable node in the interface. When I go to the website I get a 403 forbidden and there is nothing in the logs... I'm wondering what the permissions need to be on the file structure (/public, /tmp and my-app.js).

Any help or pointers would be gratefully received.

Thanks.
 
Can you provide the output of "plesk version" command (via ssh under the root user)?
Also please check if SELinux is enabled. If yes, try to disable it and check again.
 
Can you provide the output of "plesk version" command (via ssh under the root user)?
Also please check if SELinux is enabled. If yes, try to disable it and check again.

Product version: Plesk Onyx 17.0.17 Update #1
Update date: 2016/10/11 13:42
Build date: 2016/10/05 19:00
OS version: CentOS 6.8
Revision: 6425897b6c8fd41a8a3239c6ff2d7583df9b3de0
Architecture: 64-bit
Wrapper version: 1.2

I've tried with selinux enforcing and also permissive and there is no difference. :-(
 
Can you provide the content of /var/log/nginx/error.log (last 20-30 lines)? There should be something about Passenger.
 
Also try to use the following code snippet as a "Hello world" app:
Code:
const http = require('http');

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
});

server.listen(0, '0.0.0.0', () => {
  console.log('Node.js app is running...');
});
 
Can you provide the content of /var/log/nginx/error.log (last 20-30 lines)? There should be something about Passenger.

From /var/log/nginx/error.log after a service nginx restart
[ 2016-10-13 12:43:14.9445 28428/7fa2fe700700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2016-10-13 12:43:14.9445 28433/7f04b7fff700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2016-10-13 12:43:14.9446 28433/7f04bc4d77e0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2016-10-13 12:43:14.9446 28428/7fa2ff2ac7e0 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2016-10-13 12:43:14.9447 28433/7f04b75fe700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2016-10-13 12:43:14.9447 28433/7f04b75fe700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2016-10-13 12:43:14.9449 28428/7fa2fd1fc700 Ser/Server.h:817 ]: [ServerThr.3] Freed 128 spare client objects
[ 2016-10-13 12:43:14.9449 28428/7fa2fdc7e700 Ser/Server.h:817 ]: [ServerThr.2] Freed 128 spare client objects
[ 2016-10-13 12:43:14.9449 28428/7fa2fdc7e700 Ser/Server.h:464 ]: [ServerThr.2] Shutdown finished
[ 2016-10-13 12:43:14.9449 28428/7fa2fd1fc700 Ser/Server.h:464 ]: [ServerThr.3] Shutdown finished
[ 2016-10-13 12:43:14.9449 28428/7fa2d7fff700 Ser/Server.h:817 ]: [ServerThr.4] Freed 128 spare client objects
[ 2016-10-13 12:43:14.9449 28433/7f04b7fff700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2016-10-13 12:43:14.9449 28428/7fa2d7fff700 Ser/Server.h:464 ]: [ServerThr.4] Shutdown finished
[ 2016-10-13 12:43:14.9450 28428/7fa2fe700700 Ser/Server.h:817 ]: [ServerThr.1] Freed 128 spare client objects
[ 2016-10-13 12:43:14.9450 28428/7fa2fe700700 Ser/Server.h:464 ]: [ServerThr.1] Shutdown finished
[ 2016-10-13 12:43:14.9451 28428/7fa2d75fe700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2016-10-13 12:43:14.9451 28428/7fa2d75fe700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2016-10-13 12:43:14.9454 28433/7f04bc4d77e0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2016-10-13 12:43:15.0139 28428/7fa2ff2ac7e0 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
[ 2016-10-13 12:43:15.1536 10311/7f6df34b67e0 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2016-10-13 12:43:15.1595 10314/7f37696f37e0 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-10-13 12:43:15.1596 10314/7f37696f37e0 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-10-13 12:43:15.1620 10314/7f37696f37e0 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 10314
[ 2016-10-13 12:43:15.1650 10321/7f2b0ffec7e0 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-10-13 12:43:15.1660 10321/7f2b0ffec7e0 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 10321



Tried with the hello world app as well, I thought that this my customers app might be an issue so I had thought that I would use this as the test app... same result.


Here are the logs from httpd/error.log after a service httpd restart and attempt to load the app.

[Thu Oct 13 12:51:25 2016] [notice] caught SIGTERM, shutting down
[Thu Oct 13 12:51:28 2016] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Thu Oct 13 12:51:28 2016] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Oct 13 12:51:28 2016] [warn] No JkLogFile defined in httpd.conf. Using default /etc/httpd/logs/mod_jk.log
[Thu Oct 13 12:51:28 2016] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Oct 13 12:51:28 2016] [notice] Digest: generating secret for digest authentication ...
[Thu Oct 13 12:51:28 2016] [notice] Digest: done
[Thu Oct 13 12:51:28 2016] [notice] mod_bw : Memory Allocated 0 bytes (each conf takes 48 bytes)
[Thu Oct 13 12:51:28 2016] [notice] mod_bw : Version 0.92 - Initialized [0 Confs]
[Thu Oct 13 12:51:28 2016] [warn] No JkLogFile defined in httpd.conf. Using default /etc/httpd/logs/mod_jk.log
[Thu Oct 13 12:51:28 2016] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status
[Thu Oct 13 12:51:28 2016] [error] python_init: Python version mismatch, expected '2.6.5', found '2.6.6'.
[Thu Oct 13 12:51:28 2016] [error] python_init: Python executable found '/usr/bin/python'.
[Thu Oct 13 12:51:28 2016] [error] python_init: Python path being used '/usr/lib64/python26.zip:/usr/lib64/python2.6/:/usr/lib64/python2.6/plat-linux2:/usr/lib64/python2.6/lib-tk:/usr/lib64/python2.6/lib-old:/usr/lib64/python2.6/lib-dynload'.
[Thu Oct 13 12:51:28 2016] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Thu Oct 13 12:51:28 2016] [notice] mod_python: using mutex_directory /tmp
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] RSA server certificate CommonName (CN) `Plesk' does NOT match server name!?
[Thu Oct 13 12:51:28 2016] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Oct 13 12:51:28 2016] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 mod_jk/1.2.40 Phusion_Passenger/5.0.30 PHP/5.4.45 mod_python/3.3.1 Python/2.6.6 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

again tried the hello world app and still same result :-(

Update: The Hello World app works fine when called like this:
root@lightning my-app]# /opt/plesk/node/4/bin/node ./app.js
And when the listening port is changed from 0 to 8080 (firewall opened on 8080 also)
 
Last edited:
After the investigation on the server I found the following. You have an .htaccess file in the docroot of domain (httpdocs directory). This file has strange enough permissions (webserver could not read it). I didn't fix the permissions on the file, but renamed it into .htaccess.bak (because it contains some rewrite rules related to PHP app). After that Node.js app become happy :)
 
Hello , I have the same error but i haven't .haccces on my domain root , any idea to resolve it

thanks
 
Back
Top