Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nutgaard/nginx-nextjs-test
Testing how to achieve multiple basePaths with single instance of NextJs
https://github.com/nutgaard/nginx-nextjs-test
Last synced: 2 months ago
JSON representation
Testing how to achieve multiple basePaths with single instance of NextJs
- Host: GitHub
- URL: https://github.com/nutgaard/nginx-nextjs-test
- Owner: nutgaard
- Created: 2023-07-15T21:28:26.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-15T21:37:41.000Z (over 1 year ago)
- Last Synced: 2023-07-15T22:26:53.984Z (over 1 year ago)
- Language: TypeScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nginx-Nextjs-Test
This is a test project to investigate using Nginx as reverse proxy to achieve a setup with Next.js which supports multiple basePaths.
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```## Running with proxy
To achieve multiple `basePath` while still using a single Next.js application there is a nginx reverse proxy included.
There are two ways of starting the application in development mode;
1. Start the Next.js app with `npm run dev` and start the local-proxy `docker compose up local-proxy`. This is done automatically with the command `make dev-local`
2. Start the Next.js app within a docker container with the `/src` folder mounted. This is done automatically with the command `make dev`In both cases hot-reloading works as expected. And it is a matter of taste which approach to use.
To build the application and test it in "production mode", run `make start`. This will first build your application, before starting it and the proxy.
**Summary:**
```
make dev # Next.js app is running on host-system
make dev-local # Next.js app is running within a container
make start # Build and create docker images, and starts them
make stop # Stops all containers within this project
```