Strapi on vps works not on subdomain but on vps ip

Hello everyone!, I am new here so let me say this first: what an amazing platform is strapi!!! Congrats to everyone working and developing strapi!

I installed strapi on a subdomain; the problem is that I can only access it from the vps ip (like 172.222.222.111:1337/admin ), not the subdomain. When I start strapi the terminal shows me the correct link (https://api.domain.com/folder/admin) but there I get a 404 not found error.

As a side effect, I can access and test any api because I am whitelisted on vps firewall, but no one else can have access :sweat_smile:

I tried to mess up with server js file but whatever I do the result is the same.
Any idea may help, Thank you.

System Information
  • Strapi Version: latest
  • Operating System: CENTOS 7.9
  • Database: mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
  • Node Version: v12.20.1
  • NPM Version: 6.14.11
  • Yarn Version: 1.22.4cd

Can you attach the server.js code?
Also, please attach the nginx config that you used to map the subdomain to your internal address.

Looks like I dont have nginx on server, maybe that is the problem.

Here is the server.js file. Also it is interesting that on start, the terminal guides me to the correct path, where i get 404 not found.

Sc