• 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

Issue Node.js using plesk extension

jtthemarine

New Pleskian
I have been working on a node.js webapp on my server for a while. I recently updated my plesk to onyx and noticed they had an extension.

So I backed up my node.js app, uninstalled node.js from the server and proceeded to add the extension.

I re-uploaded the app and added it via the plesk panel. However it never starts.

I figured I messed something up so I uploaded a fresh simple "Hello world" as the how to explains. Still nothing.

ps x shows no case of node running even after the panel says it is running.
 
That is actually the article I was referring to.

node_js_not_starting.png


The server.js contains

Code:
const http = require('http');

http.createServer(function(request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end("Hello, World!\n");
}).listen(process.env.PORT);

console.log('App is running...');

Going to the url displays an apache2 test page.

ps x shows no instance of node running
 
After re-reading the article again, I noticed that it mention errors are posted to the main error_log and not the domains. So after pulling that up I found there is a permission error.

Code:
[Tue Jan 24 23:00:30 2017] [notice] caught SIGTERM, shutting down
[Tue Jan 24 23:00:30 2017] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Tue Jan 24 23:00:30 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 24 23:00:30 2017] [error] *** Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog (/usr/lib64/passenger/support-binaries/PassengerAgent): Permission denied (errno=13)

I have tried
Code:
chcon -v --type=httpd_sys_content_t server.js

However the same error persists
 
Last edited:
Just set Selinux to permissive and it does function. However shouldn't of setting the type of allowed it to run with Selinux enabled?
 
You can leave selinux in enabled mode if you set the following two selinux booleans;

Code:
setsebool -P httpd_run_stickshift 1
setsebool -P httpd_execmem 1

However, I think this issue should be resolved in the psa-selinux package as that comes with a custom Plesk selinux policy.
 
Back
Top