https://github.com/johnfmorton/example-static-docker-website-for-traefik
A static website server from a Docker container and routed with Traefik.
https://github.com/johnfmorton/example-static-docker-website-for-traefik
docker docker-compose nginx traefik
Last synced: about 2 months ago
JSON representation
A static website server from a Docker container and routed with Traefik.
- Host: GitHub
- URL: https://github.com/johnfmorton/example-static-docker-website-for-traefik
- Owner: johnfmorton
- License: mit
- Created: 2023-07-19T19:14:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-10T18:59:57.000Z (over 1 year ago)
- Last Synced: 2025-03-15T04:29:16.347Z (over 1 year ago)
- Topics: docker, docker-compose, nginx, traefik
- Language: HTML
- Homepage: https://hello-world.morton.dev/
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE.txt
Awesome Lists containing this project
README
# Sample static website for Traefik
This repo contains a docker-compose.yml that creates a static website and a Traefik reverse proxy. It was created to test the Traefik reverse proxy with a static website when using Laravel Forge, but it should work for any server that has Docker installed where you are testing Traefik.
It was created to be used as a sample web site for the following repo: https://github.com/johnfmorton/traefik-for-laravel-forge
## The accompanying blog post
For a complete write-up on using this repo, read [*Analytics a different way. Plausible Analytics on Laravel Forge with Traefik and Docker.*](https://supergeekery.com/blog/plausible-analytics-on-laravel-forge-with-traefik-and-docker)
## Usage
The repo assumes you have Docker installed and running.
As shown in the reference repo above, it also assumes you have a Traefik container running. The Traefik container should be running on the same network as the containers created by this repo. The Traefik container uses a network called `proxy` by default. If you are using a different network, you will need to update the `docker-compose.yml` file in this repo to use the correct network.
To start the containers, run the following command:
```
docker-compose -p basic-web-site -f docker-compose.yml up -d --remove-orphans
```
## DNS and the environment file
Using the [`example.env`](/example.env) file as a reference, create a `.env` file in the same directory as the `docker-compose.yml` file. The `.env` file should contain the following variables:
```
SITE_URL=example.com
```
You will also need to configure your DNS host to point the domain name to the IP address of the server where the containers are running.
## About the directories
The `web` directory contains the static website files.
The `web` directory is mounted as a volume in the `nginx` container. The `nginx` container is configured to serve the files in the `web` directory. The `index.html` file should display a simple "Hello World" message.
## License
The source code for the site is licensed under the MIT license, which you can find in
the MIT-LICENSE.txt file.