Create an app with

npx create-strapi-app@latest example

Update example/config/server.ts and add allowedHosts

export default ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  allowedHosts: 'example.com',
  app: {
    keys: env.array('APP_KEYS'),
  },
});

copy example/src/admin/vite.config.example.ts to example/src/admin/vite.config.ts and add server.allowedHosts

import { mergeConfig, type UserConfig } from 'vite';

export default (config: UserConfig) => {
  // Important: always return the modified config
  return mergeConfig(config, {
          server: {
                  allowedHosts: ['example.com'],
          },
    resolve: {
      alias: {
        '@': '/src',
      },
    },
  });
}

Configure an nginx proxy