This is a test project to investigate using Nginx as reverse proxy to achieve a setup with Next.js which supports multiple basePaths.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
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;
- Start the Next.js app with
npm run dev
and start the local-proxydocker compose up local-proxy
. This is done automatically with the commandmake dev-local
- Start the Next.js app within a docker container with the
/src
folder mounted. This is done automatically with the commandmake 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