Debugging nginx with docker


Container technology is widely used in various scenarios, in the actual application process, we can also according to their own needs, various configurations. Recently, because I was debugging nginx, I also used docker to debug nginx.


  • Docker installed
  • Docker compose is installed

Realization idea

Docker compose can help us simplify the configuration of some docker startup. By writing configuration files, we can simplify the command to start the container.

Specific operation

Create a project and place it in the root of the projectdocker-compose.ymlas well asnginx.conf. Among them,nginx.confIt’s the nginx file you need to test,docker-compose.ymlIs used to record your docker container startup configuration.

Debugging nginx with docker

Start the container and test the effect

Place the content of the profile you need to test in the nginx.conf And in docker- compose.yml Add the following to the

  image: nginx
    - "8080:80"
    - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
  command: [nginx-debug, '-g', 'daemon off;']

Then, the implementationdocker-compose upYou can start the container and show the running effect of the container

Debugging nginx with docker

At this point, you can visitlocalhost:8080To see your own configuration.

Recommended Today

Third party calls wechat payment interface

Step one: preparation 1. Wechat payment interface can only be called if the developer qualification has been authenticated on wechat open platform, so the first thing is to authenticate. It’s very simple, but wechat will charge 300 yuan for audit 2. Set payment directory Login wechat payment merchant platform( pay.weixin.qq . com) — > Product […]