Hosting with Plesk Obsidian

Hi, having some real issues getting development mode to work with this setup. I’ve got the cms working correctly on the server through plesk. I have a server.js file which simply contains the following:

const strapi = require(‘strapi’);
strapi(/* {…} */).start();

I can change the node settings in plesk to either production or development, after reloading the app it the correct shows whichever state i chose before going to the login screen. The issue is that I can’t edit collection types and get the error "The autoReload feature is required to use this plugin. Start your server with strapi develop"

How can i get this working properly so i edit collection types with this setup?

System Information
  • Strapi Version 3.4.5:
  • Operating System Ubuntu 18:
  • Database Sqllite:
  • Node Version 12:
  • NPM Version 12:
  • Yarn Version 1:

If you are running in production, the CTB (Content-type builder) is forcefully disabled in production and staging. You should not create/update/delete content-types in these environments due to how Strapi it built.

You can find more information in this FAQ: Troubleshooting - Strapi Developer Documentation

Trying to run production with the CTB enabled is not a support environment and you do so at your own risk.

1 Like

Thanks for the reply. I have node environment set to “development” and i’ve rebuilt the admin panel. is there no way to run in development mode via plesk? It shows as being in development mode but i still get the warning when opening the CTB,

We don’t have an API option to start strapi in development mode with a server.js or app.js

strapi(/* {…} */).start(); ← This is basically the same as running npm run start or yarn start and what is required to use the development mode is basically npm run develop or yarn develop but there is no strapi(/* {…} */).develop(); option.

If Plesk allows you to run a custom command you could run it like this, but as mentioned earlier we don’t support nor recommend it.

Start strapi with:

const strapi = require('strapi');

strapi({
    autoReload: true,
    serveAdminPanel: true
}).start();

It works on my shared server. :slight_smile:

1 Like

The strapi is deployed but an error is occurring when I am trying to access media library or try to upload something.
Please Help me with this A.S.A.P

Is hosting strapi on a plesk ubuntu 22.04 system actually possible?

Running latest Strapi v4 on Plesk Obsidian 18.0.46 with Node 16.17 the server.js code has to be this in my experience:

// server.js content: 

const strapi = require('@strapi/strapi');

strapi({
    autoReload: true,
    serveAdminPanel: true
}).start();

The suggested code in Strapi docs doesn’t work, it seems we have to force autoReload.

I’m currently stuck on the same issue as @rishabhchand007 had, the 403. A fix for this on Plesk is allowing directory discovery on the server, however, this will not do much since your new error will be 404 (on upload/<some_file>). The rest of the panel works perfectly fine, I’m even able to upload a new site logo. Just when I try to access the media library, or when I try to add new media, it will throw an error. @Arklogic since you managed to set this up, do you maybe have a guide for us which you followed? :slight_smile:

If any of you could help me, that would be really appreciated! :smiley:

@rishabhchand007 the problem with the 403 error has to do with nginx proxying to Apache. Turn this off and it should work. Go to:
Your strapi domain ==> Hosting & DNS ==> Apachy & nginx Settings ==> Proxy mode (under nginx) and turn it off

1 Like

Muchas Gracias por esto! Sigue funcionando en Plesk Obsidian 18.0.49 y con Node 18.

1 Like

Esto también era un problema para mi, muchas gracias por el aporte!

1 Like

Hello, I’ve been trying to deploy Strapi on mi Plesk server. I followed a couple of guides I found on internet:

Deploy Strapi on Plesk
Getting Strapi to run in Plesk

I also tried @MyKrzysiu 's strategy, but still not working. I don’t get any errors. When I go to my domain it just sends back the default Plesk template. Any Idea of why is this happening?. Should I reference a document besides server.js on NodeJS or something similar?

@fisocodes these are the steps that worked for me, running Plesk Obsidian 18.0.58 on Ubuntu 20.04.

  1. Run NODE_ENV=production strapi build
  2. Create server.js file with the following contents. NB: It should NOT have autoReload in production mode.
const strapi = require('@strapi/strapi');
const app = strapi({ distDir: './dist' });
app.start(); 
  1. Upload the ./dist directory only to your file manager.
  2. Upload your server.js and package.json files to your file manager.
  3. Create a ./public/uploads directory in your file manager.
  4. In the Node.js dashboard:
  • Update the Document Root to the public directory
  • Update the Application Root to your root directory
  • Edit the Application Startup File to your server.js file
  • Add your environment variables
  • Click “+ NPM Install”

Once this is done your file manager should look like this:

  • dist
  • node_modules
  • public
  • package.json
  • server.js

Click Restart App and it should work :rocket:

Hello Maria. you also had the same problem? I am trying to deploy my Strapi CMS into PLESK VPS, I also am having these problems with “./public/uploads” mostly with the images, they don’t load the images, it blocks me for 10 minutes and I can’t find the solution. it has to do with 403 Error. What is the real solution? Could you tell me?

[image]

@Alexander_C This is a late reply to your question, but I’ve found that Plesk will block some Strapi requests. I have had to go into the Plesk Web Application Firewall and disable rules 211760 and 210492.

Also, for anyone now using Strapi v5 the server.js file has changed (different syntax on second line):

import strapi from '@strapi/strapi';
const app = strapi.createStrapi({ distDir: './dist' });
app.start();
1 Like

I put this in the server.js STRAPI V5 y it still doesn’t work, I got this error —>>
server.js:1 import strapi from ‘@strapi/strapi’; ^^^^^^ SyntaxError: Cannot use import statement outside a module at wrapSafe (node:internal/modules/cjs/loader:1378:20) at Module._compile (node:internal/modules/cjs/loader:1428:41) at Module._extensions…js (node:internal/modules/cjs/loader:1548:10) at Module.load (node:internal/modules/cjs/loader:1288:32) at Module._load (node:internal/modules/cjs/loader:1104:12) at Module.require (node:internal/modules/cjs/loader:1311:19) at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25) at require (node:internal/modules/helpers:179:18) at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:243:2) at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:214:2) Node.js v20.18.1------------->

I made a mistake in my suggestion above. The first line should be const strapi = require('@strapi/strapi');

The key change between v4 and v5 is the second line.

1 Like

I made it like you said and it still doesnt work "const strapi = require(‘@strapi/strapi’);

const app = strapi.createStrapi({ distDir: ‘./dist’ });
app.start();
"

@Alexander_C I’m not sure what the problem is. I use Strapi regularly on Plesk without any problem. This post above describes how I set it up: Hosting with Plesk Obsidian - #14 by jeff-goodman

NB: That post is based on v4, use the new v5 syntax for the server.js file.