1

I have this hoster that use Phusion Passenger for the NodeJS environment and I want to run my Strapi App on it.

For now I did the following:

  1. Strapi and the node modules are installed on the server
  2. The app is connected to the database
  3. the app.js can start fine

I don't know how to configure my app.js file to make it launch Strapi

I did something like this but I'm pretty sure this is wrong:

const http = require("http");
const hostname = "127.0.0.1";
const port = "passenger";
const strapi = require("@strapi/strapi");

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

server.listen(port, hostname, () => {
  console.log(`Server running at https://somary.fr/`);
  strapi().start();
});

How do I configure my app.js file to finally access my strapi app?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Cielesis
  • 11
  • 1

1 Answers1

0

I'm deploying a Strapi@4.3.8 app on Phusion Passenger.

Here is my updated app.js file:

const strapi = require("@strapi/strapi");
strapi({ dir: "./build" }).start();

To create the build folder, you need to run:

npm run build

I hope I helped.