Strapi Deployment

System Information
  • Strapi Version: 3.5.4
  • Operating System: Linux 8.11
  • Database: default…
  • Node Version: 14.16.0
  • NPM Version: 7.8.0
  • Yarn Version: 1.22.10

Hi,
I’m quite new to Strapi, and I’m currently trying to deploy on a managed cloud server on Infomaniak.

So far, I’m able to follow the documentation process until the server startup NODE_ENV=production npm start.
I generated the admin with NODE_ENV=production yarn build --clean
Strapi server does start, and the url of the admin panel is displayed in the CLI.

However, the url sends a 404 error (api . mydomain . com/admin)
And the api root sends a 403 error (api . mydomain . com)

This 403 error is usually displayed by default on managed Infomaniak hosts, when the resource does not have any index file.

Therefore, I’m wondering if my configuration is correct.
Which folder is the (sub)domain address supposed to target? I targeted the root folder of the Strapi project…
I also tried the public and the build folders without success. build shows a blank html page.

Those aspects are not really covered in the documentation, if I’m not wrong.

Could you help me to set Strapi up on this host?
Thanks


Did you install/configure one of the proxy options from the documentation?

Without those, your domains would be (assuming you are using the default 1337 port)

The proxy layers are needed for SSL and to bind on ports below 1024 (as you shouldn’t be running a node process as root). HTTP uses port 80, HTTPS uses port 443.

1 Like

Thanks for your help.

I opened the 1337 port in the firewall (TCP entering and exiting).

I’m using an Apache server (2.4.46), but I’m not so sure if I have enough freedom to configure proxy on a managed hosting.
I can add environment variables though…

Also, I can’t access Strapi either with explicit port (api.mydomain.com:1337) : page not loading, timeout.

Here is my server.js

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  url: env('PUBLIC_URL', 'https://api.example.com'),
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', '[...]'),
    },
  },
});

And .env:

HOST=0.0.0.0
PORT=1337
PUBLIC_URL=[the API real url] 

Shall I use another hosting solution? If so, are there any recommandation?

That is not really an environment we support as managed hosting can have a lot of restrictions for running services.

Entirely up to you and what you are familiar with or prefer. (Cost also) I don’t think there is a single major cloud platform I haven’t seen Strapi deployed on; AWS, GCloud (Compute and GAE), Azure, DigitalOcean, Vultr, Linode, OVH, IBM Cloud, ect.

I would say in most cases hosting that gives you a “CPanel, Plesk, insert some odd Server GUI” is not something that is geared towards applications like Strapi. We are an extremely code focused headless CMS and not as database dynamic like some of the older monolithic CMSes. There will almost certainly be a need to touch the CLI/Terminal at some point and being familiar with that is certainly a good skill to have.

I understand… It’s not so obvious to get started with private/virtual hosting though.

I’m turning towards the docker container, through Jelastic.
So far I’m able to build the Strapi admin and start it. I’m now looking for a way to get access to the admin through Http.
But that’s another issue…

Thanks :slight_smile:

Edit:
By the way, it would be nice to update the recommended requirements of the documentation, for newbies like me…
Indeed, my initial hosting did meet these requirements, with Node, NPM, build-essentials…
But not the ability to configure a proxy I suppose.
Therefore, I invested quite some time with Strapi on localhost, guessing it would be compatible with my hosting service…