Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gokaygurcan/dockerfile-nginx
🐋 NGINX Dockerfile
https://github.com/gokaygurcan/dockerfile-nginx
docker dockerfile hacktoberfest hacktoberfest2022 letsencrypt nginx nginx-modules openssl web-server
Last synced: 7 days ago
JSON representation
🐋 NGINX Dockerfile
- Host: GitHub
- URL: https://github.com/gokaygurcan/dockerfile-nginx
- Owner: gokaygurcan
- License: mit
- Created: 2018-08-01T21:14:48.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T11:54:41.000Z (5 months ago)
- Last Synced: 2024-07-23T13:57:39.926Z (5 months ago)
- Topics: docker, dockerfile, hacktoberfest, hacktoberfest2022, letsencrypt, nginx, nginx-modules, openssl, web-server
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/gokaygurcan/nginx/
- Size: 133 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# NGINX
## Environment variables
| Variable | Path |
| -------------------- | ---------------------- |
| USR_SRC | /usr/src |
| USR_SRC_NGINX | /usr/src/nginx |
| USR_SRC_NGINX_MODS | /usr/src/nginx/modules || Variable | Version |
| -------------------- | ---------------------- |
| NGINX_VERSION | 1.27.1 |
| OPENSSL_VERSION | 3.3.1 |
| LIBMAXMINDDB_VERSION | 1.11.0 |## Additional packages
- libbrotli-dev
- libmaxminddb-dev
- libpcre3
- libpcre3-dev
- libxml2
- libxml2-dev
- libxslt1-dev
- mmdb-bin
- uuid-dev
- zlib1g
- zlib1g-dev## Volumes
| Path | Description |
| ---------------- | -------------------------------------------------------------------------------------- |
| /etc/nginx | NGINX configurations |
| /var/log/nginx | NGINX logs |
| /var/www | Default www folder |
| /etc/letsencrypt | Let's Encrypt files (see [certbot](https://github.com/gokaygurcan/dockerfile-certbot)) |
| /usr/share/GeoIP | GeoIP database folder (see below) |## Ports
| Port | Process | TCP/UDP |
| ---- | ------- | ------- |
| 80 | NGINX | TCP |
| 443 | NGINX | TCP |## CMD
```bash
sudo nginx -g daemon off;
```## Usage
To pull the image
```bash
docker pull gokaygurcan/nginx
```To run an NGINX container
```bash
# clone this repository
git clone https://github.com/gokaygurcan/dockerfile-nginx.git# cd into it
cd dockerfile-nginx# run nginx with the default configurations
docker run --rm -d --name nginx -p 80:80 -p 443:443 \
-v `pwd`/docker/etc/nginx:/etc/nginx \
gokaygurcan/nginx# see if cURL returns anything good
curl -i http://localhost
```## GeoIP
To use GeoIP, you need to download City and/or Country databases from MaxMind. The best way to do it is to use their Docker container.
```bash
# create a volume for persistency
docker volume create usr-share-geoip# download geoip databases
docker run --rm --name geoipupdate \
-v usr-share-geoip:/usr/share/GeoIP \
-e GEOIPUPDATE_FREQUENCY=0 \
-e GEOIPUPDATE_ACCOUNT_ID='' \
-e GEOIPUPDATE_LICENSE_KEY='' \
-e GEOIPUPDATE_EDITION_IDS='GeoLite2-City GeoLite2-Country' \
maxmindinc/geoipupdate# you can start nginx with this additional volume now
docker run --rm -d --name nginx -p 80:80 -p 443:443 \
-v `pwd`/docker/etc/nginx:/etc/nginx \
-v usr-share-geoip:/usr/share/GeoIP \
gokaygurcan/nginx
```