Need help with app sructure on hosting deployment

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

First of all I have to say that I was able to make Strapi work on hosting, but not the way it supposed to be.

I am using Setup NodeJs App in CPanel. I have a website at ‘mydomain,com’. I have successfully installed strapi on a subdomain ‘test,mydomain,com’ and can access admin panel from ‘test,mydomain,com/admin’, and it works fine and api works fine and everything is right. Except that I want it to be on my main domain instead of a subdomain but I can’t make it work right.

What I tried: I create a /strapi folder in the root of my website and move all the strapi files there. In the CPanel NodeJS settings for the Application root I put public_html/strapi, for Application URL I put mydomain.com/admin. Then I build the app and start it. In the browser at mydomain.com/admin I have the login page and after I’m trying to sign in I get the infinite loading icon and an error “An error occurred during models config fetch.” I know that something is off with the structure, but I cannot figure out what exactly. My ./config/server.js file is standard:

module.exports = ({ env }) => ({
host: env(‘HOST’, ‘0.0.0.0’),
port: env.int(‘PORT’, 1337),
});

Also there has been a folder ‘admin’ created in the root of my website with .htaccess file:

PassengerAppRoot “/home/mylogin/public_html/strapi”
PassengerBaseURI “/admin”
PassengerNodejs “/home/mylogin/nodevenv/public_html/strapi/14/bin/node”
PassengerAppType node
PassengerStartupFile server.js

ErrorDocument 404 /404.php
php_flag display_errors on
php_value error_reporting 2047

I would really appreciate if anyone can help me with setting up Strapi the right way.