38 lines
1.7 KiB
Markdown
38 lines
1.7 KiB
Markdown
Nginx Reverse Proxy Setup
|
|
|
|
This repository provides a setup to run an Nginx container as a reverse proxy. The backend address and port can be set via environment variables.
|
|
Repository Structure
|
|
|
|
Dockerfile: Contains instructions to build the custom Nginx Docker image.
|
|
nginx.conf: Nginx configuration to set up reverse proxy using environment variables.
|
|
docker-compose.yml: Docker Compose configuration to build and run the Nginx container.
|
|
|
|
Setup Instructions
|
|
1. Clone the Repository
|
|
|
|
To get started, first clone the repository:
|
|
|
|
bash
|
|
|
|
git clone https://codeberg.org/Iridium-net/lan-to-nginx.git
|
|
cd lan-to-nginx
|
|
|
|
2. Modify Environment Variables (Optional)
|
|
|
|
The docker-compose.yml file has environment variables set for a backend address of 192.168.8.1 and port 80. If you want to point the reverse proxy to a different backend, modify the docker-compose.yml file and adjust the BACKEND_ADDRESS and BACKEND_PORT environment variables.
|
|
3. Build and Run
|
|
|
|
Using Docker Compose, build and run the setup:
|
|
|
|
bash
|
|
|
|
docker-compose up --build -d
|
|
|
|
The --build flag ensures that the image is built using the provided Dockerfile. The -d flag runs the container in detached mode.
|
|
4. Access
|
|
|
|
Once the container is running, access any machine where Docker is running on port 80. It will reverse proxy the request to the backend specified (in this example, 192.168.8.1:80).
|
|
Notes
|
|
|
|
This setup uses the image from codeberg.org/Iridium-net/lan-to-nginx:latest. If you modify the Dockerfile and wish to use the locally built image, the docker-compose.yml configuration takes care of this by specifying both a build context and an image name.
|
|
Make sure to adjust firewall or security group settings if you're running this in a cloud environment or behind a firewall. |