Admin/init not found on live server

Hello there. I am very new to strapi but not to gridsome.
I have followed the tutorial as such GitHub - strapi/strapi-starter-gridsome-portfolio: Build portfolio sites using Strapi and Gridsome

On localhost everything works fine.

I have build the strapi backend and uploaded it to my /admin folder on my server
When I enter Strapi Admin I see a spinning wheel and a console error of
[Error] Failed to load resource: the server responded with a status of 404 () (init, line 0)

Again on localhost the admin works perfectly.
The gridsome build upload works fine.

I tried my very best to understand similar topics on google or GitHub but I by the best of my efforts I have no idea what to do to resolve this.

Thank you for your time and expertise

You can’t build the backend. Only the Frontend.

You just uploaded the files from build to /admin folder on your server? Without the backend?

From what I see your backend is not running at all.
How do you start it? How do you proxy requests from your domain to strapi?

Oh okay — I did indeed uploaded the files from build directory to my admin folder.

I have to remain silent in my answers to: How do you start it? How do you proxy requests from your domain to strapi?

This is new for me so I have absolutely no idea :wink: As mentioned I followed the starter tutorial and feel it is missing crucial informations for newbies like me. I am used to gridsome and cmd’s like forestry. I must be missing a crucial step here.

Thanks for your willingness to answer my question though.
All the best

That’s totally wrong.
You should upload the entire project. Not only the content from the build folder. The build folder contains only the admin functionality & user-interface. But it should communicate with the backend. You should start the strapi on your production server.
Take a look at the deployment section.

What exactly is new to you? Nodejs servers? Nginx / apache? Deployment?

Thank you. it wasn’t clear to me reading the starter tutorial.

I am new to strapi and this way of deployment. I have published a few gridsome / forestry websites through netlify in the past as they have basically a one click tutorial set up.

Thanks for your link. I will spend the next week digging deeper.
All the best

Please hold on. What do you mean by “You should copy the whole project”? Do you mean we need to copy the whole thing including the package.json, node_modules folder etc?
Can you please be specific about this?

That’s exactly what I meant, copy everything from your local project, except:

node_modules (since it weights a lot) - you should install packages directly on the production server with (npm install or yarn install).
.cache and build folders - you should build the UI in production with the production env (NODE_ENV=production npm run build or NODE_ENV=production yarn build)

That’s exactly how node.js apps work, it can’t work without node_modules, package.json and etc.

If you are new to strapi/node apps, and you don’t know why there are node_modules and package.json, then I would first recommend finishing a basic crash course for node.js apps, as it will be much easier for you to understand how strapi works.

I was working on Angular before, so have a little idea about the npm, node_modules and package.json. And we just build the production version and copy only the build files to production.

But yeah, I’m new to node.js apps. Thought the production deployment would be same as Angular, but it’s not.

Thanks you.

But I do have a concern here.
After cross-env NODE_ENV=production npm start in cmd in production, the cmd has to be kept open for the admin site to run & by closing the command prompt stops the StrApi admin site.

Is it the time where pm2 plays the role? Does using pm2 will solve the above problem?

Take a look at this example:

You can also use ecosystem config.
Create a file ecosystem.config.js in your project’s root folder:

module.exports = {
  apps: [
      name: 'your-app-name',
      script: 'npm',
      args: 'start',
      env: {
        NODE_ENV: 'production',
      exp_backoff_restart_delay: 100,

Now you can start your app in production with:
pm2 start ecosystem.config.js

The code that I’ve defined in the config is equal to: NODE_env=production npm run start

Thanks for your help.
Followed the steps and started the application. After this step, the StrApi site should be up and running right? But the site is not loading in browser. Am I missing any steps?

How exactly are you trying to access it? By IP address and port or by Domain ?

I think you are missing the proxy part. Take a look at this documentation for Nginx:

To check if it’s running, you can try the following command in CLI:
Also, you can view the app’s logs by using pm2 logs command, there you should see if it runned succesfully without errors.

By IP Address and port. Do we need to setup the nginx?

pm2 logs has the following error

Your app is crashing in PM2, something wasn’t setup right.

Is this running on a windows server? O_o?

While that should work, it certainly isn’t recommended, and it’s not an environment we run regular tests on.

Where are you hosting?

Angular is a frontend framework, just like React/Next and Vue/Nuxt.

Strapi has two parts: React Admin panel (gets built and served) and a Koa.js backend (that services the statically built admin while also holding the code for the APIs and connecting to the database).

Yep. This is my windows machine and I’m trying to setup and test the production version in my local machine first before we push it to actual production hosting server.

And yes, our hosting server is a Windows Server.

Can you please help me with setting up the PM2?

My ecosystem.config.js and package.json are as following.


Am I missing anything in the configuration?