Need Help : NGINX proxy with Strapi Deploy Problem

System Information
  • Strapi Version: 3.5.3
  • Operating System: Ubuntu 16.0.4
  • Database: Postgres
  • Node Version: 12.18.3
  • NPM Version: 6.14.6
  • Yarn Version:

Hi guys, I’m pretty new to Strapi and new to backend and server stuff as well. This is my first project with Strapi. I am developing a website with Strapi as the backend. Now I tried to deploy it to Digitalocean. I tried the App platform but it didn’t work out and with the security issue warning so I swapped to using Droplet instead. I deployed the project with NGINX proxy as guided in the documents (Nginx Proxying - Strapi Developer Documentation).

I proxied the api to /api

and the admin to /admin

so I set the config/production/server.js to

module.exports = ({ env }) => ({

    host: env('HOST', 'localhost'),

    port: env.int('PORT', 1337),

    url: '<mydomain>/api',

    admin: {

        url: '<mydomain>/admin',

    },

});

However, once I ran the page ‘/admin’, it said only “Not found” on the screen. But, if I remove config/production/server.js and left with only config/server.js (this one has no url and admin.url), the admin page shows the first-time registration page properly but as soon as I registered the Superadmin user, a fatal error occurred. I inspected the problem and found that the content-manager/content-type could not be found because of the wrong path (/content-manager/content-type instead of /api/content-manager/content-type) and if I refresh the page the page crashes and from the log seems that it tries to create a relation that already exist

I suspect that this is related to the fact that content-type could not be found…

I’m stuck with this problem too long already, anyone has any clue about how to fix this problem? I would really appreciate it.