Skip to content

Enhance your Next.js app with Traefik integration—no Docker needed. This repo streamlines a personalized host setup like "nextjs.localhost" using a reverse proxy and load balancer. Achieve secure HTTPS access via TLS with mkcert. Simplify deployment, configure Traefik and Next.js settings effortlessly for optimal performance.

License

Clement-Muth/nextjs-traefik

Repository files navigation

Traefik Integration with Next.js App

Overview

This repository serves as a guide and configuration setup for integrating Traefik with a Next.js application WITHOUT docker. The goal is to implement Traefik as a reverse proxy and load balancer, providing a customized host, such as "nextjs.localhost." Additionally, the setup includes TLS integration for secure HTTPS access, utilizing a certificate generated by mkcert.

Prerequisites

Before getting started, ensure you have the following prerequisites installed on your system:

  • Traefik
  • Mkcert

Getting Started

Follow these steps to integrate Traefik with your Next.js app:

  1. Clone this repository:

    git clone https://github.com/Clement-Muth/nextjs-traefik.git
  2. Navigate to the project directory:

    cd nextjs-traefik
  3. Generate SSL certificates using mkcert:

    mkcert -uninstall
         sudo rm -rf /etc/ssl/certs/mkcert*
         mkdir -p certs/root
         mkcert -cert-file certs/cert.pem -key-file certs/key.pem "nextjs.localhost"
         mkcert -install
  4. Update Traefik configuration in the traefik/dynamic.yaml file as needed.

  5. Run traefik:

    traefik --configFile=traefik/traefik.yaml
  6. Access the Next.js app using the configured host:

    https://nextjs.localhost

Configuration Details

Traefik Configuration (traefik/dynamic.yaml/traefik/traefik.yaml)

Adjust the Traefik configuration based on your requirements. This file includes settings for entry points, middleware, and SSL certificates.

Contributing

Feel free to contribute to this project by opening issues or submitting pull requests. Your feedback and enhancements are highly appreciated!

License

This project is licensed under the MIT License.


About

Enhance your Next.js app with Traefik integration—no Docker needed. This repo streamlines a personalized host setup like "nextjs.localhost" using a reverse proxy and load balancer. Achieve secure HTTPS access via TLS with mkcert. Simplify deployment, configure Traefik and Next.js settings effortlessly for optimal performance.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published