1

Topic: Ngnix server not coming up on fresh install

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): latest
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? -
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
on executing:  systemctl status nginx.service test
Starting The nginx HTTP and reverse proxy server...
nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.service: control process exited, code=exited status=1
Failed to start The nginx HTTP and reverse proxy server.
Unit nginx.service entered failed state.
nginx.service failed.

It is obviously a Nginx topic, but I don't have that much experience with it, yet. Where do I find the config file containing the parameter throwing the exception?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Ngnix server not coming up on fresh install

Did you modify any settings after iRedMail installation?
iRedMail doesn't have any "map_hash*" parameter in Nginx config files.

3

Re: Ngnix server not coming up on fresh install

ZhangHuangbin wrote:

Did you modify any settings after iRedMail installation?
iRedMail doesn't have any "map_hash*" parameter in Nginx config files.

Nope, nothing. I used a fresh installation image from my V-Server provider in the state of Centos 7 Minimum. The only other installations I did where I added nano and Bzip2.
That there is no such setting explains at least why I couldn't find it. What can I do?

4

Re: Ngnix server not coming up on fresh install

Run "nginx -t", it will show you the file and line which causes the issue.

5

Re: Ngnix server not coming up on fresh install

The message I receive is:
[root@mail ~]# nginx -t
nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@mail ~]#


the content of the mentioned file is:

user nginx;
worker_processes 1;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/conf-enabled/*.conf;
    include /etc/nginx/sites-enabled/*.conf;
}

all settings came through the installation. I have not made any changes and rebooted prior to testing with "ngnix-t"

6

Re: Ngnix server not coming up on fresh install

I didn't have this error, did you use any third-party yum repository?

7

Re: Ngnix server not coming up on fresh install

no, I didn't, only what comes along with Centos 7 by default.
Wouldn't it be easisest to follow this and increase that hash_bucket_size? I would only need to know how to do that.

8

Re: Ngnix server not coming up on fresh install

Please show me output of command "rpm -qi nginx".

9

Re: Ngnix server not coming up on fresh install

that is:
Name        : nginx
Epoch       : 1
Version     : 1.12.2
Release     : 2.el7
Architecture: x86_64
Install Date: Sa 18 Aug 2018 17:02:34 CEST
Group       : System Environment/Daemons
Size        : 1574949
License     : BSD
Signature   : RSA/SHA256, Di 06 Mär 2018 10:44:06 CET, Key ID 6a2faea2352c64e5
Source RPM  : nginx-1.12.2-2.el7.src.rpm
Build Date  : Di 06 Mär 2018 10:27:44 CET
Build Host  : buildhw-02.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://nginx.org/
Bug URL     : https://bugz.fedoraproject.org/nginx
Summary     : A high performance web server and reverse proxy server
Description :
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
IMAP protocols, with a strong focus on high concurrency, performance and low
memory usage.

10

Re: Ngnix server not coming up on fresh install

I did iRedMail installation on CentOS 7 for testing moment ago, few differences:

- No /etc/nginx/params.conf at all.
- No error "could not build map_hash, you should increase map_hash_bucket_size"

Try to fix it by running commands below:

echo 'map_hash_bucket_size 1024;' > /etc/nginx/conf-available/map_hash_bucket_size.conf
ln -s /etc/nginx/conf-available/map_hash_bucket_size.conf /etc/nginx/conf-enabled/map_hash_bucket_size.conf
service nginx restart

11

Re: Ngnix server not coming up on fresh install

[root@mail ~]# echo 'map_hash_bucket_size 1024;' > /etc/nginx/conf-available/map_hash_bucket_size.conf
[root@mail ~]# ln -s /etc/nginx/conf-available/map_hash_bucket_size.conf /etc/nginx/conf-enabled/map_hash_bucket_size.conf
[root@mail ~]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@mail ~]#
The messages result in:
[root@mail ~]# systemctl status nginx.service
? nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Di 2018-08-21 17:22:48 CEST; 56s ago
  Process: 12552 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
  Process: 12550 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Aug 21 17:22:48 mail.domain.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Aug 21 17:22:48 mail.domain.com nginx[12552]: nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32
Aug 21 17:22:48 mail.domain.com nginx[12552]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 21 17:22:48 mail.domain.com systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 21 17:22:48 mail.domain.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Aug 21 17:22:48 mail.domain.com systemd[1]: Unit nginx.service entered failed state.
Aug 21 17:22:48 mail.domain.com systemd[1]: nginx.service failed.
I exchanged mail.domain.com here not to show my real domain

12

Re: Ngnix server not coming up on fresh install

i'm confused ... it should be fixed with the /etc/nginx/conf-enabled/map_hash_bucket_size.conf.

13

Re: Ngnix server not coming up on fresh install

I restarted the server and have the same result, however I checked the
journalctl -xe
and got this as response:
Unregistered Authentication Agent for unix-process:2149:23924 (system bus name :1.30, object path /org/freedesktop/Poli

besides the map_hash_bucket_size topic. Is it maybe an authorization topic with ngnix? I executed the install as root.

14

Re: Ngnix server not coming up on fresh install

janbroORG wrote:

Aug 21 17:22:48 mail.domain.com nginx[12552]: nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 32

i'm confused. If our fix doesn't work, at least this error message should print the value (1024) we set, not "32".

Try this:

* Remove file /etc/nginx/conf-enabled/map_hash_bucket_size.conf.
* Open file /etc/nginx/conf-enabled/cache.conf, add below line as FIRST LINE in this file:

map_hash_bucket_size 1024;

* Run 'nginx -t' and show us the output.

15

Re: Ngnix server not coming up on fresh install

the result is:
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

and
service nginx restart
Redirecting to /bin/systemctl restart nginx.service

16

Re: Ngnix server not coming up on fresh install

OK, it works now.