docker hub上找到鏡像
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIwczX0xiRGZkRGZ0Xy9GbvNGL2EzXlpXazxSP9cmT6lERNNTRq1EM4wmYwhGWhxGZzwEMW1mY1RzRapnTtxkb5ckYplTeMZTTINGMShUYfRHelRHLwEzX39GZhh2css2RkBnVHFmb1clWvB3MaVnRtp1XlBXe0xyayFWbyVGdhd3LcV2Zh1Wa9M3clN2byBXLzN3btg3Pn5GcuITO4UDM0MTM1EzNwEjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
拉取鏡像
docker pull rookiezoe/nginx
配置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