openbridge / nginx

NGINX Accelerated! This is a Docker image that creates a high performance (FAST!), optimized image for NGINX for use with Redis and PHP-FMP. Deliver sites and applications with performance, reliability, security, and scale. This NGINX server offers advanced performance, web and mobile acceleration, security controls, application monitoring, and management.
https://www.openbridge.com/
MIT License
233 stars 53 forks source link

"variables_hash_max_size" directive is duplicate #50

Closed xavierdemoor closed 5 years ago

xavierdemoor commented 5 years ago

Describe the bug When I docker-compose up, I have this error before nginx exiting:

2019/07/04 12:02:38 [emerg] 1#1: "variables_hash_max_size" directive is duplicate in /etc/nginx/conf.d/botblocker-nginx-settings.conf:18

To Reproduce Steps to reproduce the behavior:

  1. I just picked the docker-compose php example (and changing paths)

Expected behavior

Additional context I'm using Docker for Windows

tspicer commented 5 years ago

Can you paste your compose file? Also, what is in the path you are mounting? For example, what base configs are you using?

xavierdemoor commented 5 years ago

docker-compose.yml

version: '3.1'
services:
  nginx:
    image: openbridge/nginx
    container_name: nginx
    depends_on:
      - redis
    ports:
      - 80:80
      - 443:443
    tty: true
    tmpfs: /var/cache
    restart: unless-stopped
    volumes:
      - ./conf/php/nginx:/conf/php/nginx
      - ./conf/php/monit:/conf/php/monit
      - ./web:/usr/share/nginx/html
    ulimits:
      nproc: 65535
      nofile:
          soft: 49999
          hard: 99999
    env_file:
      - ./env/php.env
  redis:
    image: redis:alpine
    restart: unless-stopped
    container_name: redis
volumes:
  site:

I took the conf and env files from this repo. I didn't change anything in those files. In my /web folder, I only have a index.php with phpinfo();

the botblocker-nginx-settings.conf file is present in the container but not in the conf/ folder.

tspicer commented 5 years ago

Ok, I released a fix. Not sure why this started to occur, but it looks like something on the botblocker side. Since botblocker us a runtime config, a change upstream can cause a problem like this. For now I commented out the botblocker config.

tspicer commented 5 years ago

I just ran the installer for https://wordpress.chatlytics.co/ and everything worked without error.

xavierdemoor commented 5 years ago

Thank you !

goat-io commented 5 years ago

I'm still getting the same problem (same config than above) I have tried with several different tags. What version is supposed to have the fix?

tspicer commented 5 years ago

Hi, can you try setting an ENV variable: https://github.com/openbridge/nginx#activating-bot-protection

Please share your ENV settings as well.

goat-io commented 5 years ago

Hi, I tried with both the bot enabled and disabled. Same results

ENV

NGINX_SERVER_NAME=127.0.0.1
NGINX_CONFIG=php
NGINX_DEV_INSTALL=false
PHP_FPM_UPSTREAM=wordpress:9000
REDIS_UPSTREAM=redis:6379
NGINX_PROXY_UPSTREAM=localhost:8080
NGINX_DOCROOT=/usr/share/nginx/html
NGINX_BAD_BOTS=true

Compose

nginx_prod:
    build:
      context: .
      dockerfile: ./docker/nginx/Dockerfile
    depends_on:
      - redis
    ports:
      - 80:80
      - 443:443
    tty: true
    ulimits:
      nproc: 65535
      nofile:
        soft: 49999
        hard: 99999
    restart: unless-stopped
    networks:
      - wordpress-network
    env_file:
      - ./.env

Dockerfile (Just some custom config for woocommerce cache and cdn)

FROM openbridge/nginx:latest
COPY --chown=www-data:www-data ./docker/nginx/cdn.conf  /conf/php/nginx/conf.d/cdn.conf
COPY --chown=www-data:www-data ./docker/nginx/nocache.map  /conf/php/nginx/map.d/nocache/nocache.map
tspicer commented 5 years ago

Can you also share some of the log outputs docker logs nginx or whatever you have it named?

goat-io commented 5 years ago

Here is the last portion of the logs

Nothing to update for directory: /etc/nginx/conf.d
Nothing to update for directory: /etc/nginx/bots.d
Nothing to update for directory: /usr/local/sbin
Setting mode: 700 => /usr/local/sbin/install-ngxblocker
Setting mode: 700 => /usr/local/sbin/setup-ngxblocker
Setting mode: 700 => /usr/local/sbin/update-ngxblocker
set daemon 10
    with START DELAY 15
set pidfile /run/monit.pid
set statefile /run/monit.state
set httpd port 2849 and
    use address localhost
    allow localhost
set logfile syslog
set eventqueue
    basedir /var/run
    slots 100
include /etc/monit.d/*
Starting Monit 5.25.2 daemon with http interface at [localhost]:2849
Monit start delay set to 15s
2019/08/19 22:42:15 [emerg] 1#1: "variables_hash_max_size" directive is duplicate in /etc/nginx/conf.d/botblocker-n
ginx-settings.conf:18
nginx: [emerg] "variables_hash_max_size" directive is duplicate in /etc/nginx/conf.d/botblocker-nginx-settings.conf
:18
goat-io commented 5 years ago

Hi @tspicer,

I had to stop all the services, do a complete system prune

system prune -a

to remove everything from my local system and only after this full prune a got it back working. Seems that somehow was a local image/volume problem. Very likely that is safe to close this issue. Thanks for your help