nginx web server, http2 + SSL + Security Header + gzip + non-root configured, production ready
643
nginx web server, http2 + SSL + Security Header + gzip + non-root configured, production ready
| Configurations | |
|---|---|
| Base Image | nginx (Version is dynamically updated by Dependabot) |
| Container Name | awesome-nginx |
| Volumes | ./nginx/conf.d → /etc/nginx/conf.d (Read-Only)./nginx/ssl → /etc/nginx/ssl (Read-Only)./nginx/html → /usr/share/nginx/html (Read-Only) |
| Network | |
| Working Directory | /etc/nginx |
| Expose Port | 80, 443 |
docker build --tag tomy0000000/nginx:1.17 .
# Clone existed file structure to host
mkdir nginx
docker run --name tmp-nginx -d tomy0000000/nginx:1.17
docker cp tmp-nginx:/etc/nginx/nginx.conf nginx/nginx.conf
docker cp tmp-nginx:/etc/nginx/nginx.conf.backup nginx/nginx.conf.backup
docker cp tmp-nginx:/etc/nginx/conf.d nginx/conf.d
docker cp tmp-nginx:/etc/nginx/ssl nginx/ssl
docker cp tmp-nginx:/usr/share/nginx/html nginx/html
docker rm -f tmp-nginx
docker-compose up --detach
docker run \
--detach \
--publish 80:80 \
--publish 443:443 \
--name awesome-nginx \
tomy0000000/nginx
docker run \
--detach \
--publish 80:80 \
--publish 443:443 \
# --link awesome-php-fpm \
--volume="$PWD/nginx/nginx.conf:/etc/nginx/nginx.conf:ro" \
--volume="$PWD/nginx/conf.d:/etc/nginx/conf.d:ro" \
--volume="$PWD/nginx/ssl:/etc/nginx/ssl:ro" \
--volume="$PWD/nginx/html:/usr/share/nginx/html" \
--name awesome-nginx \
tomy0000000/nginx:1.17
docker exec -it awesome-nginx ./generate_http1_vhost.sh "example.com"
docker exec -it awesome-nginx ./generate_http2_vhost.sh "example.com"
./nginx/htmldocker exec -it awesome-nginx bash
docker exec -it awesome-nginx nginx -t
docker kill --signal HUP awesome-nginx
docker restart awesome-nginx
127.0.0.1 example.com entry in /etc/hosts| Description | Container Path | Host Path |
|---|---|---|
| server configuration | /etc/nginx/nginx.conf | ./nginx/nginx.conf |
| virtual host configuration | /etc/nginx/conf.d | ./nginx/conf.d |
| SSL certificates | /etc/nginx/ssl | ./nginx/ssl |
| static contents | /usr/share/nginx/html | ./nginx/html |
nginx
├── conf.d # vhost conf
│ ├── default.conf # Custom default
│ ├── default.conf.backup # Official default (as reference, not in used)
│ ├── example.com.conf # genereated with site_ssl.conf.template
│ ├── site.conf.template # exmaple http conf (as reference, not in used)
│ └── site_ssl.conf.template # exmaple https conf (as reference, not in used)
├── html # content directories
│ ├── default # http://localhost:80
│ │ ├── 50x.html
│ │ └── index.html
│ └── example.com # https://exmaple.com:443
│ ├── 50x.html
│ └── index.html
├── nginx.conf # Custom default server conf
├── nginx.conf.backup # Official default server conf (as reference, not in used)
└── ssl # certificates
├── example.com.crt
└── example.com.key
Content type
Image
Digest
sha256:7dc0418ce…
Size
82 MB
Last updated
over 2 years ago
docker pull tomy0000000/nginx