docker-compose安装nginx,配置headers_more_filter_module模块

docker-compose.yml

version: "3.7"
services:
  nginx:
    restart: always
    image: rookiezoe/nginx # headers_more_filter_modules模块镜像
    privileged: true
    ports:
      - 9010:80
    volumes:
      - /var/dlp/data/nginx/logs:/var/log/nginx
      - /var/dlp/data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf

nginx.conf

user  nginx;
worker_processes  auto;

load_module modules/ngx_http_headers_more_filter_module.so; # 加载模块
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
    server {
     listen 80;
     server_name  127.0.0.1;
        location / {
        proxy_pass http://ip:9090/;
        more_clear_headers X-Frame-Options;
     }
   }

}

启动:docker-compose up -d 

停止:docker-compose down

猜你喜欢

转载自blog.csdn.net/weixin_42170236/article/details/109472975