# HTTP Map module no longer in binary or source build?

**URL:** <https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706>\
**Category:** NGINX\
**Tags:** syntax, config\
**Created:** [May 3, 2025, 12:10am UTC](https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706 "2025-05-03T00:10:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swampcritter](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/swampcritter/32/1543_2.png) [@Swampcritter](https://community.nginx.org/u/Swampcritter)\
**Post date:** [May 3, 2025, 12:10am UTC](https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706/1 "2025-05-03T00:10:44Z")

</div>

**My issue** :  
I am trying to do a simple map for the log format (trying to setup for using GoAccess app, but I keep getting an error that the map module can’t be found or the map config is incorrrect. If I comment out the ‘map’ in the config, the nginx -t passes. But fails if I re-add it. I have tried this with both v1.18 (Ubuntu 22.04 binary), v1.24 (Ubuntu 24.04 binary) and v1.28 (source code), but it seems the “ngx\_http\_map\_module” or “http\_map\_module” is either no longer an option even if specifically asked in the ./configure. It shows it can be disabled, but not enabled.

**How I encountered the problem** :  
Ran the basic “nginx -t” against my code and it keeps spitting out the same error:

```auto
nginx: [emerg] unexpected "{" in /etc/nginx/nginx.conf:57
nginx: configuration file /etc/nginx/nginx.conf test failed

```

**Solutions I’ve tried** :  
Still trying to find one that actually works.

nginx.conf with map entry:

```auto
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 1024;
        multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

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

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        map $time_local $log_time_custom {
            default "";
            ~^(?P<day>[0-9]{2})/ # Capture day
             (?P<month>[A-Za-z]{3})/ # Capture month
             (?P<year>[0-9]{4}): # Capture year
             (?P<hour>[0-9]{2}): # Capture hour
             (?P<minute>[0-9]{2}): # Capture minute
             (?P<second>[0-9]{2}) # Capture second
             \s(?P<tz_offset>[+-][0-9]{4})$
             "$weekday $month $day $hour:$minute:$second $tz_abbr $year";
        }

        map $time_local $weekday {
            default "";
            ~^(?P<wday>[A-Za-z]{3})/.+$ $wday;
        }

        map $time_local $tz_abbr {
            default "";
            ~^.+ \s(?P<tz>[A-Z]+)$ $tz;
        }

        ##
        # Virtual Host Configs
        ##

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

```

**My config** :

Ubuntu v1.28 configuration (source) - fails on the map module:

```auto
./configure \
--with-cc-opt='-g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/nginx-5QYLpr/nginx-1.24.0=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/nginx-5QYLpr/nginx-1.24.0=/usr/src/nginx-1.24.0-2ubuntu7.3 -fPIC -Wdate-time -D_FORTIFY_SOURCE=3' \
--with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIC' \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=stderr \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--modules-path=/usr/lib/nginx/modules \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-compat \
--with-debug \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_sub_module \
--with-mail_ssl_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-stream_realip_module \
--with-http_geoip_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_perl_module=dynamic \
--with-http_xslt_module=dynamic \
--with-mail=dynamic \
--with-stream=dynamic \
--with-stream_geoip_module=dynamic
--with-http_map_module

```

Ubuntu U22 Binary configs

```auto
>> nginx -V 2>&1
nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-niToSo/nginx-1.18.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-geoip2 --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-headers-more-filter --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-cache-purge --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-ndk --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-echo --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-fancyindex --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/nchan --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/rtmp --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-uploadprogress --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-niToSo/nginx-1.18.0/debian/modules/http-subs-filter

```

---

<div class="post-metadata">

**Author:** ![alessandro](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/alessandro/32/4836_2.png) [@alessandro](https://community.nginx.org/u/alessandro)\
**Post date:** [May 5, 2025, 7:35pm UTC](https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706/2 "2025-05-05T19:35:33Z")

</div>

> [@Swampcritter](#):
>
> ```auto
> nginx: [emerg] unexpected "{" in /etc/nginx/nginx.conf:57
> 
> ```

Heya! This seems to be an issue with your NGINX config, not the `map` module. Curly braces are a special character so NGINX thinks you are starting a new block in the middle of your map directive. Can you try wrapping everything in double quotes? (You might need to remove the comments.)

---

<div class="post-metadata">

**Author:** ![Swampcritter](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/swampcritter/32/1543_2.png) [@Swampcritter](https://community.nginx.org/u/Swampcritter)\
**Post date:** [May 15, 2025, 4:54pm UTC](https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706/3 "2025-05-15T16:54:59Z")

</div>

Yes, you were correct. I had the formatting wrong and needed to switch a few things around to get it to function.

```auto
http {

     map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
     }

    # Correctly placed and structured map blocks
    map $time_local $weekday {
        default "";
        "~^([A-Za-z]{3})/" $1;
    }

    map $time_local $tz_abbr {
        default "";
        "~.* ([A-Z]+)$" $1;
    }

    log_format custom_log '$remote_addr - [$time_local] $weekday $tz_abbr "$request" $status $body_bytes_sent';

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

    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;

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

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    gzip on;

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

```

---

<div class="post-metadata">

**Author:** ![system](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/system/32/19_2.png) [@system](https://community.nginx.org/u/system)\
**Post date:** [July 15, 2025, 8:52pm UTC](https://community.nginx.org/t/http-map-module-no-longer-in-binary-or-source-build/2706/4 "2025-07-15T20:52:51Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
