An open API service indexing awesome lists of open source software.

https://github.com/clement-muth/nextjs-traefik

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.
https://github.com/clement-muth/nextjs-traefik

https load-balancer mkcert nextjs reverse-proxy tls traefik without-docker

Last synced: 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# Traefik Integration with Next.js App

## Overview

This repository serves as a guide and configuration setup for integrating [Traefik](https://traefik.io/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](https://github.com/FiloSottile/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:

```bash
git clone https://github.com/Clement-Muth/nextjs-traefik.git
```

2. Navigate to the project directory:

```bash
cd nextjs-traefik
```

3. Generate SSL certificates using mkcert:

```bash
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:

```bash
traefik --configFile=traefik/traefik.yaml
```

6. Access the Next.js app using the configured host:

```bash
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](LICENSE.md).

---