sofshant
sofshant

Reputation: 313

NodeJS on plesk is showing all the source code on the url

I'm running a VPS with Plesk (CentOS 8 and Apache). My problem is that the NodeJS plugin is showing all the source code on the URL. For example, if I go on site.com, the expected content shows up but if I go to site.com/server.js, the entire server code is visible. This applies to everything including package.json. As a side note, the server.js file is not a client-side javascript file. It is the one NodeJS is running.

Any help is appreciated.

Apache config:

ServerRoot "/etc/httpd"
Listen 7080
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html index.shtml index.cfm index.php index.htm
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%a %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
GracefulShutDownTimeout 3
AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Upvotes: 0

Views: 419

Answers (1)

Tom hanz
Tom hanz

Reputation: 1

if you still need to but dont think so use cloudfalre and use this (http.request.uri.path in {"js" "cjs" "env" "md" "prisma" "json"}) or (http.request.uri contains ".js") or (http.request.uri contains ".env")

Upvotes: 0

Related Questions