• 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
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

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