# nginx proxy

##

## [https://github.com/nginx-proxy/nginx-proxy](https://github.com/nginx-proxy/nginx-proxy)



## reverse-proxy

```
docker run \
    --name reverse-proxy \
    -v /docker/nginx/certs:/etc/nginx/certs:ro \
    -v /docker/nginx/vhost.d:/etc/nginx/vhost.d \
    -v /docker/nginx/html:/usr/share/nginx/html \
    -v /docker/nginx/conf.d:/etc/nginx/conf.d \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    --label nginx_proxy=true \
    -p 80:80 \
    -p 443:443 \
    -d \
    --restart unless-stopped \
    --network ServerFarm \
    jwilder/nginx-proxy
```

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-M2MoNPxmklTDMMH9FiO%2F-M2MoXjmfqcsIE0MOuf3%2Fimage.png?alt=media\&token=b2f06bfd-50f3-40b1-a127-5e2186ce89a3)

nginx site

```
docker run \
    --name www \
    -e 'VIRTUAL_HOST=www.kawsing.org' \
    -d \
    --restart unless-stopped \
    --network ServerFarm \
    nginx:alpine
```

於之前的 docker dns server 建立正解檔&#x20;

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-M2MoNPxmklTDMMH9FiO%2F-M2N1Tp7NttUGXSz28uX%2Fimage.png?alt=media\&token=c39b7c6b-3332-49d0-ae39-e8270bdf2091)

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-M2MoNPxmklTDMMH9FiO%2F-M2N1IkqPeuDlVgtFuXn%2Fimage.png?alt=media\&token=9ce71718-07a2-4056-bdcf-61349516c659)

{% embed url="https://依照以上步驟，建立www2.kawsing.org" %}

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-M2N2cEE52aiAJUer5qY%2F-M2N2r3QcmFf0loNHJpL%2Fimage.png?alt=media\&token=4df873d5-00d6-46de-bc2a-715ce6e23855)

```
docker run \
    --name www2 \
    -e 'VIRTUAL_HOST=www2.kawsing.org' \
    -d \
    --restart unless-stopped \
    --network ServerFarm \
    nginx:alpine
```
