Tips when setup Nginx Docker
2018-07-15 本文已影响0人
凸大愚若智凸
Default configuration file inside Nginx docker is located under /etc/nginx/conf.d
, named default.conf
.
Be aware that the file name is a little bit different from default one on Ubuntu. On Ubuntu, it's located and named /etc/nginx/sites-available/default
, while on Nginx docker it's located and named /etc/nginx/conf.d/default.conf
.
- Run the Nginx docker in
detach
(or saydaemon
) mode, and mount local/etc/nginx/sites-available/
folder to/etc/nginx/conf.d/
in docker.
docker run --name <nginx-container> -v /etc/nginx/sites-available/:/etc/nginx/conf.d -d nginx
- If you want to check something inside Nginx docker, run below:
docker exec -it <nginx-container> bash
- If there's something wrong with access to Nginx docker, firstly you want to check if
ping
works correctly, butping
by default is not installed in Nginx docker, so run below command to installping
:
apt update
apt install iputils-ping
docker exec -it <nginx-container> bash
ping <host-ip>