The original post: /r/nginx by /u/peoples888 on 2024-09-20 00:58:41.
Hey everyone,
My nextjs app has this example file structure:
code /my-next-app ├── /app # App Router directory (replaces /pages) │ ├── /about # About page folder (maps to /about) │ │ └── page.tsx # Page component for the /about route │ ├── /blog # Blog folder for nested routing (maps to /blog) │ │ ├── /[id] # Dynamic route (maps to /blog/:id) │ │ │ └── page.tsx # Page component for dynamic blog post │ │ └── page.tsx # Page component for /blog route │ ├── /contact # Contact page folder (maps to /contact) │ │ └── page.tsx # Page component for /contact route │ ├── /layout.tsx # Root layout (applies to all routes) │ └── page.tsx # Main page for the root route (/) ├── /public # Static assets (images, fonts, etc.) ├── /styles # Global styles, e.g., CSS, SCSS files ├── /components # Shared React components ├── /hooks # Custom React hooks ├── /utils # Utility functions ├── next.config.js # Next.js configuration ├── package.json # Project dependencies and scripts └── tsconfig.json
Sorry in advance for mobile formatting.
I’m building this app via Docker and serving via Nginx. Unfortunately this is not code I can share.
When deployed in AWS ECS, health checks to the base URL get 308 status.
Let’s say the base URL is my-site.com/app This URL returns 404. All sub-URLs of this work perfectly fine, like my-site.com/app/about.
From what I gather, the base page.tsx in the app directory is not being served, while all other page.tsx files have no problem.
With the info I’ve provided… any ideas? I feel like I’ve tried everything as far as messing with the Nginx.conf.
EDIT: can’t add pictures here but check comments for a screenshot of the hierarchy.