docker_practice/appendix/repo/nginx.md

50 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# [Nginx](https://hub.docker.com/_/nginx/)
##
[Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。
`https://hub.docker.com/_/nginx/` Nginx 1.0 ~ 1.19.x
## 使
```bash
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
```
使 Dockerfile
```docker
FROM nginx
COPY static-html-directory /usr/share/nginx/html
```
```bash
$ docker build -t some-content-nginx .
$ docker run --name some-nginx -d some-content-nginx
```
`8080`
```bash
$ docker run --name some-nginx -d -p 8080:80 some-content-nginx
```
Nginx `/etc/nginx/nginx.conf`使
```bash
$ docker run -d \
--name some-nginx \
-p 8080:80 \
-v /path/nginx.conf:/etc/nginx/nginx.conf:ro \
nginx
```
## Dockerfile
https://github.com/docker-library/docs/tree/master/nginx 查看。