美文网首页
Tips when setup Nginx Docker

Tips when setup Nginx Docker

作者: 凸大愚若智凸 | 来源:发表于2018-07-15 12:48 被阅读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 say daemon) 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, but ping by default is not installed in Nginx docker, so run below command to install ping:
    apt update
    apt install iputils-ping
    docker exec -it <nginx-container> bash
    ping <host-ip>
    

    相关文章

      网友评论

          本文标题:Tips when setup Nginx Docker

          本文链接:https://www.haomeiwen.com/subject/sjlppftx.html