0

i tried using this tutorial to deploy my server on cpanel vps hosting https://blog.cpanel.com/how-to-host-a-node-js-application-with-cpanel/

i performed each and every steps as told by them and tried to deploy the same file they did. it worked completely fine till i was using running my server on terminal and got the response also, but when i performed the further steps of REGISTERING APPLICATION WITH APPLICATION MANAGER it is not showing me relevant output on the browser.

PS: I also tried adding .htaccess, it also didn't work.

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php81” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

</IfModule>

this is my app.js

const http = require('http')
const hostname = '127.0.0.1';
const port = 3000;

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

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

it is showing me this output (https://i.stack.imgur.com/5vaMM.png)

What am i doing wrong?

0 Answers0