This project describes how to deploy a Next.js application using Docker and Nginx Proxy Manager.
It is linked to the following YouTube videos:
Before starting, make sure you have Docker and Docker Compose installed on your machine. You can follow the official instructions to install Docker on Ubuntu here:
This command creates a Docker network named nginx that will be used to connect the containers.
sudo docker network create nginxUse the following command to build the Docker image from the Dockerfile in the current directory. The -t nextjs-docker option assigns a name to the Docker image.
docker build -t nextjs-docker .This command starts the services defined in the docker-compose.yml file in detached mode (in the background).
sudo docker compose up -dIf you need to recreate the containers (e.g., after modifying the configuration), use the --force-recreate option.
sudo docker compose up -d --force-recreateTo access a specific container, use docker exec with the -it option to open an interactive session in the nginx-proxy-manager-app-1 container.
sudo docker exec -it nginx-proxy-manager-app-1 bashAdd the following configuration to define the site location. This configuration tells Nginx to serve the content from the /site/app-3 directory at the root of the URL.
location / {
root /site/app-3;
}- Make sure to replace
/site/app-3with the correct path to the directory where your application is deployed. - Check the container names and configurations specific to your deployment environment.
By following these steps, you should be able to deploy your Next.js application using Docker and Nginx Proxy Manager. Feel free to consult the linked documentation for more details and advanced configuration.