• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue NodeJS app permissions

DavidCorral94

New Pleskian
Hey there!

I just acquired a VPS Ubuntu server. It has Plesk in order to manage it. I wanted to deploy my NodeJs application but I found an issue/question related to the permissions.

The thing is, I have this line of code:
app.use('/', express.static(path.join(__dirname + '/public')));

Which means that if I enter in http://test.com (lets say that is my domain), it should always display the content of the folder /public:
  • If I enter in http://test.com/test.js, if the test.js file does not exists (in the public folder), it should display "Cannot GET /test.js".
  • Also, If I go to http://test.com/server.js (being server.js out of the public folder, but existing) it should also display "Cannot GET /server.js" due to server.js is not in the public folder.
This is working fine in localhost and in Heroku, but not in my VPS server.

In my VPS server, if I enter in http://test.com/server.js (and server.js exists on the root of my NodeJs app folder) it displays my entire "server.js" source code, which is not good...

I think that this is a problem with permissions, but in this case I'm not an expert, so I would like to get some support from you.

Thanks and best regards!
 
Back
Top