https://github.com/hkdigital/docker-image--nginx
Docker image with NGINX and some default configurations like a SPA webserver with proxy settings for a prerender service
https://github.com/hkdigital/docker-image--nginx
docker-image nginx
Last synced: 12 months ago
JSON representation
Docker image with NGINX and some default configurations like a SPA webserver with proxy settings for a prerender service
- Host: GitHub
- URL: https://github.com/hkdigital/docker-image--nginx
- Owner: HKdigital
- License: isc
- Created: 2021-06-18T09:21:25.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-22T10:04:34.000Z (about 3 years ago)
- Last Synced: 2025-06-12T08:45:54.158Z (about 1 year ago)
- Topics: docker-image, nginx
- Language: Shell
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# About
The image generated by this project can be used to run an NGINX server.
The docker image contains default configurations for different setups. The default configuration that is installed is `webserver`.
An interesting configuration is `spa-with-prerender` for public websites (this requires an additional docker container for the prerendering).
Another interesting configuration is `development-proxy`. This proxy can be run on a local development machine to distribute (proxy) requests from a single port to frontend and backend server ports. This works great in combination with a service like [NGROK](https://ngrok.com/).
See the [examples](https://github.com/HKdigital/docker-image--nginx/tree/main/examples) folder for more details about how to use the default configurations.
# Usage
## Just try it out (using docker-compose)
Below an example of using the image in a docker-compose file.
In the `/examples` folder, you'll find more `docker-files` for the different setups.
```yaml
version: "3.9"
services:
website:
image: hkdigital/nginx # docker-hub
# image: hkdigital-nginx # local
restart: always # "no"|always|on-failure|unless-stopped
ports:
# Let docker choose port numbers on the host
# - "80"
# host-port -> container port
- "1080:80"
volumes:
- ./volumes:/mnt # contains: webroot, config, certificates, log, media
```
### Check NGINX config and reload NGINX when ok
Using the container script
```
docker-compose exec website /srv/check-nginx-config-and-reload.sh
```
This can be done manually too
```bash
docker-compose exec website nginx -t -c /@config/nginx.conf
docker-compose exec website nginx -s reload
```
# Build locally
If you just want to use the image to create a container, there is no need to build the image locally. You can use the image from docker-hub.
Building the image locally is usually done for development of the image itself.
## Get a working copy from the repository
Clone the latest commit from github into a local working directory.
```bash
git clone --depth 1 \
git@github.com:hkdigital/docker-images--nginx.git \
hkdigital-nginx
```
## Build the docker image
```bash
./build-latest-image.sh
docker image ls
# Shows hkdigital-nginx
```