# Requesting help with HTTP2 configuration in default.conf

**URL:** <https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218>\
**Category:** NGINX\
**Tags:** http2, web-server, config\
**Created:** [November 13, 2025, 2:41pm UTC](https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218 "2025-11-13T14:41:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tty725](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/tty725/32/3520_2.png) [@Tty725](https://community.nginx.org/u/Tty725)\
**Post date:** [November 13, 2025, 2:41pm UTC](https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218/1 "2025-11-13T14:41:56Z")

</div>

```auto
# nginx -v
nginx version: nginx/1.24.0 (Ubuntu)

# ls /etc/nginx/sites-enabled/
default.conf xxx1.conf xxx2.conf

```

When adding `http2` to all the `listen` lines in the three `conf` files, `default.conf` looks like this:

```auto
listen 80 http2 default_server;
listen [::]:80 http2 default_server;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;

```

The difference between `default.conf` and `xxx1.conf / xxx2.conf` is that the latter two have specified domain names for `server_name`, but do not have `default_server`.

After successfully running `sudo nginx -t && sudo nginx -s reload`, visiting the domains for `xxx1.conf` and `xxx2.conf` works fine. However, when using `http://ip` or `http://{unspecified domain}`, the browser does not open the homepage but instead downloads a file named with no extension and only 57 bytes in size.

If you modify `default.conf` to remove `http2` from the `listen` lines, while keeping `http2` in the `listen` lines of `xxx1.conf / xxx2.conf`, after running `sudo nginx -t && sudo nginx -s reload` successfully, visiting the domains for `xxx1.conf` and `xxx2.conf` works fine, and using `http://ip` or `http://{unspecified domain}` also works correctly and opens the homepage.

However, `sudo nginx -t && sudo nginx -s reload` will show warning messages:

```auto
2025/11/13 22:11:27 [warn] 250001#250001: protocol options redefined for 0.0.0.0:80 in /etc/nginx/sites-enabled/xxx2.conf:2
2025/11/13 22:11:27 [warn] 250001#250001: protocol options redefined for 0.0.0.0:443 in /etc/nginx/sites-enabled/xxx2.conf:8
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
2025/11/13 22:11:27 [warn] 250004#250004: protocol options redefined for 0.0.0.0:80 in /etc/nginx/sites-enabled/xxx2.conf:2
2025/11/13 22:11:27 [warn] 250004#250004: protocol options redefined for 0.0.0.0:443 in /etc/nginx/sites-enabled/xxx2.conf:8
2025/11/13 22:11:27 [notice] 250004#250004: signal process started

```

How should the configuration be set so that accessing `http://ip` or `http://{unspecified domain}` works correctly, and `sudo nginx -s reload` does not show any warning messages?

---

<div class="post-metadata">

**Author:** ![liam](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/liam/32/99_2.png) [@liam](https://community.nginx.org/u/liam)\
**Post date:** [November 13, 2025, 3:51pm UTC](https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218/3 "2025-11-13T15:51:31Z")

</div>

This is a harmless warning because you’re redefining the same listen port.  
The `http2` parameter of the `listen` directive was deprecated with 1.25.1/1.26.0 in favor of the `http2` directive.

Upgrading and migrating to the `http2` directive will remove the warnings.

> **[Module ngx\_http\_v2\_module](https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2)**

---

<div class="post-metadata">

**Author:** ![Tty725](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/tty725/32/3520_2.png) [@Tty725](https://community.nginx.org/u/Tty725)\
**Post date:** [November 14, 2025, 5:49am UTC](https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218/4 "2025-11-14T05:49:02Z")

</div>

Thank you

---

<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:** [November 21, 2025, 5:49am UTC](https://community.nginx.org/t/requesting-help-with-http2-configuration-in-default-conf/8218/5 "2025-11-21T05:49:11Z")

</div>

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