我通过 docker-compose 文件安装了 nginx:1.15.6 容器,我想从所有 nginx 响应中删除服务器标头,通过搜索我发现以下方式设置“more_set_headers 'Server: custom';” 在 nginx 配置中但有错误响应。如何删除 nginx docker 中的服务器标头?我想我应该安装“headers-more-nginx-module-0.33”模块,但我不知道如何安装它:(
错误 :
[emerg] 1#1: unknown directive "more_set_headers" in /etc/nginx/conf.d/default.conf:22
Run Code Online (Sandbox Code Playgroud)
docker-compose 文件:
version: '3'
services:
web:
build:
context: nginx
container_name: r_nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./code:/code
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/ssl:/etc/ssl
- ./nginx/logs:/var/log/nginx
restart: always
depends_on:
- php
php:
build: phpfpm
container_name: r_php
restart: always
volumes:
- ./phpfpm/raya.ini:/opt/bitnami/php/etc/conf.d/custom.ini
- ./code:/code
Run Code Online (Sandbox Code Playgroud)
默认.conf:
server_tokens off;
server {
listen 80;
listen 443 ssl;
ssl on;
ssl_protocols TLSv1.1 …Run Code Online (Sandbox Code Playgroud)