[PR #1397] [CLOSED] Fix: Move http2 directive inside listen to resolve “unknown directive http2” error #4362

Closed
opened 2026-02-28 12:00:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/0xJacky/nginx-ui/pull/1397
Author: @AndreaF17
Created: 10/17/2025
Status: Closed

Base: devHead: patch-1


📝 Commits (1)

  • 0bf97f0 Combine ssl and http2 directives in nginx config

📊 Changes

1 file changed (+2 additions, -3 deletions)

View changed files

📝 docs/guide/nginx-proxy-example.md (+2 -3)

📄 Description

Summary

This PR updates the NGINX configuration to correctly enable HTTP/2 by moving the http2 directive inside the listen statement.
Previously, using http2 as a standalone directive caused:

nginx: [emerg] unknown directive "http2" in /etc/nginx/sites-enabled/default:XX

Problem

The original configuration:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;

    ...
}

Using http2 as a separate directive is not supported by NGINX.
This breaks the reverse proxy setup, especially for services that require WebSocket or HTTP/2.

Solution

The http2 directive is now placed correctly inside the listen statement:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ...
}

This ensures proper HTTP/2 support and removes the startup error.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/0xJacky/nginx-ui/pull/1397 **Author:** [@AndreaF17](https://github.com/AndreaF17) **Created:** 10/17/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`0bf97f0`](https://github.com/0xJacky/nginx-ui/commit/0bf97f04e35ef0d6bd2a820293757853d019cd81) Combine ssl and http2 directives in nginx config ### 📊 Changes **1 file changed** (+2 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/guide/nginx-proxy-example.md` (+2 -3) </details> ### 📄 Description # Summary This PR updates the NGINX configuration to correctly enable HTTP/2 by moving the http2 directive inside the listen statement. Previously, using http2 as a standalone directive caused: ``` nginx: [emerg] unknown directive "http2" in /etc/nginx/sites-enabled/default:XX ``` # Problem The original configuration: ``` server { listen 443 ssl; listen [::]:443 ssl; http2 on; ... } ``` Using http2 as a separate directive is **not supported by NGINX**. This breaks the reverse proxy setup, especially for services that require WebSocket or HTTP/2. # Solution The http2 directive is now placed correctly inside the listen statement: ``` server { listen 443 ssl http2; listen [::]:443 ssl http2; ... } ``` This ensures proper HTTP/2 support and removes the startup error. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 12:00:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#4362
No description provided.