Where to access and edit strapi in product IP address port for access

Hi,

I’m reading through the documentaiont and in this page it says you can access module.exports = { host: '0.0.0.0', };

and strapi.config.get but neither one of these give me access to edit the port that it would be on.

i have strapi up and running on a remote database that i have setup and I have the ip address of my device that it is deployed on but I don’t know which port it is on as port 1337 isn’t working. Where can I change that so I can access my strapi in production.

./config/server.js or if you are using the environment system ./config/env/production/server.js

These can also be set via environment variables, for more information on that I suggest reading through the documentation:

thank you. So if I have self setup postgres on my own cloud computer would I just leave admin: auth: secret blank? It says that environmental configs do not need to contain all these values so long as they exist in the default which I’m having a hard time understanding what it means.

edit: it says the default undefined which I guess it means I could just leave it blank, right?

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', 'someSecretKey'),
    },
  },
});

this is my current database.js in case it helps

module.exports = ({ env }) => {
  if (env('NODE_ENV') === 'development') {
    return {
      defaultConnection: 'default',
      connections: {
        default: {
          connector: 'bookshelf',
          settings: {
            client: 'sqlite',
            filename: env('DATABASE_FILENAME', '.tmp/data.db'),
          },
          options: {
            useNullAsDefault: true,
          },
        },
      },
    }
  } else {
    return {
      defaultConnection: 'default',
      connections: {
        default: {
          connector: 'bookshelf',
          settings: {
            client: 'postgres',
            host: env('DATABASE_HOST', 'localhost'),
            port: env.int('DATABASE_PORT', 5432),
            database: env('DATABASE_NAME', 'strapi'),
            username: env('DATABASE_USERNAME', 'john'),
            password: env('DATABASE_PASSWORD', 'password'),
            schema: env('DATABASE_SCHEMA', 'public'), // Not Required
            ssl: {
              rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
            },
          },
          options: {
            ssl: env.bool('DATABASE_SSL', false),
          },
        },
      },
    }
  }
};

databases are entirely different, those would be the database.js files yes. Out of curiosity, that database config structure looks like something from Alex the Entreprenerd - YouTube. While it works, it’s not what we recommend.

Regarding that auth.secret, that has nothing to do with the database. It’s the secret key used to encrypt the JWTs.

If you are referring to the env() functions, I would suggest reading this documentation which explains how they work: Configurations - Strapi Developer Documentation


Outside of that, I’m not sure what you are asking.

I got the database from this guy here when I was deploying it to gcloud and transfered it over to what I’m using it now.

so if I have no JWT then I can just leave it blank, correct?

I’m going to read through that again. The problem I’m having is that I have ssh into my cloud computer, did a git pull, and deployed my strapi into production and now I’m confused on how to access it. Because on gCloud and similar services they tell you where to go to see your app in production. But since I’m doing it cloud computer personally it’s not telling me that info

JWT is what users get when they login and make API requests, it has nothing to do with deployment or the database.

I’m not sure what you mean by “cloud computer”

I’m using dream cloud so you select how much ram and cpu you want and you select your version of linux you want to install and you just ssh into it. I installed postgres and configed it and you know the rest.

If strapi and PG are on the same host you should just need the host (127.0.0.1), port (should be 5432 for PG), username, password, and database name. You won’t need SSL unless you configured it and the default schema for PG is public.

You will however need to create the database, user, pass, and grant privileges to that user on that database. See for example: Creating user, database and adding access on PostgreSQL | by Arnav Gupta | Coding Blocks | Medium

hmmmm I’m getting This site can’t be reached and ip address refused to connect.

Is there a way to setup a domain or to see which ip address it is running at?

I have postgres with user, with permission and database setup and I’m connecting to it via dbeaver and able to see everything.

I am ssh into the terminal and run npm run-script build and i see that it is successful building, just not able to access it.

Thank you for all of your help and input.

I’m going to reread everything. I think I’m missing something and need to reread evertyhing