← Start of tutorial

WIUNIX ACADEMY

Build Nginx with HTTP/3 and verify QUIC

Page 2 of 5. Review the earlier steps and prerequisites before continuing.

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

AlmaLinux 10.2Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment3 editable values
04

LET’S BUILD

Create the initial HTTP site

Save these contents with your real hostname. Replace only the generated configuration for this new lab installation; preserve a copy first if you have already customized it.

Start on TCP 80 so ACME can validate the hostname before TLS refers to certificate files. The dedicated web root will contain the demonstration and ACME challenge files.

Nginx · /opt/nginx-quic/conf/nginx.conf

File contents · save in the editor

user academy-nginx;
worker_processes auto;
pid /run/academy-nginx-quic/nginx.pid;
error_log /opt/nginx-quic/logs/error.log warn;
events { worker_connections 1024; }
http {
    include mime.types;
    default_type application/octet-stream;
    server {
        listen 80;
        server_name h3.example.com;
        root /var/www/academy-quic;
        location / { try_files $uri $uri/ =404; }
    }
}
How do I know it worked?

The lab file contains the intended hostname and dedicated web root.

Open the service unit

Open the editor with this command. The next section contains the file contents; substitute the required hostname and paths before saving.

Bash

Server terminal · opens the editor

sudo test ! -e /etc/systemd/system/academy-nginx-quic.service && sudo test ! -L /etc/systemd/system/academy-nginx-quic.service || exit 1
sudoedit /etc/systemd/system/academy-nginx-quic.service
05

LET’S BUILD

Create a dedicated systemd unit

The dedicated unit uses one exact binary for validation, start, reload and stop. systemd owns the runtime PID directory. Its two reload commands run sequentially; failed validation prevents the next command.

The root master binds privileged ports and reads protected keys, while workers use academy-nginx. Never make private keys world-readable. This lab unit requires a separate production hardening review.

systemd · /etc/systemd/system/academy-nginx-quic.service

File contents · save in the editor

[Unit]
Description=WIUNIX Academy Nginx QUIC lab
After=network.target

[Service]
Type=forking
RuntimeDirectory=academy-nginx-quic
RuntimeDirectoryMode=0755
PIDFile=/run/academy-nginx-quic/nginx.pid
ExecStartPre=/usr/sbin/restorecon -RF /run/academy-nginx-quic
ExecStartPre=/opt/nginx-quic/sbin/nginx -t
ExecStart=/opt/nginx-quic/sbin/nginx
ExecReload=/opt/nginx-quic/sbin/nginx -t
ExecReload=/opt/nginx-quic/sbin/nginx -s reload
ExecStop=/opt/nginx-quic/sbin/nginx -s quit
TimeoutStopSec=30

[Install]
WantedBy=multi-user.target
How do I know it worked?

The named unit points only to this lab's binary and PID file.

06

LET’S BUILD

Start HTTP and check the network path

Reinspect all listeners before creating the new web root and starting the validated dedicated unit. Preserve other services; if required ports are owned, stop this exercise instead of stopping their owner.

On RPM, complete the preceding SELinux file/UDP policy steps first. Confirm actual worker account and, on enforcing RPM, httpd_t process confinement; service active alone proves no external request.

Bash

Server terminal · sudo where shown

set -eu
sudo ss -lntup
check_root_parent() {
  local parent="$1" parent_uid parent_mode
  test -d "$parent" && test ! -L "$parent" || { printf 'STOP: directory/link: %s\n' "$parent" >&2; exit 1; }
  parent_uid=$(stat -c %u -- "$parent") || exit 1
  parent_mode=$(stat -c %a -- "$parent") || exit 1
  if [ "$parent_uid" != 0 ] || (( (8#$parent_mode & 0022) != 0 )); then
    printf 'STOP: require root-owned non-writable parent: %s\n' "$parent" >&2; exit 1
  fi
}
for parent in / /opt /var; do check_root_parent "$parent"; done
check_root_parent '/opt/nginx-quic'
if [ ! -e /var/www ] && [ ! -L /var/www ]; then sudo mkdir -m 755 /var/www; fi
check_root_parent /var/www
sudo mkdir -m 755 '/var/www/academy-quic'
printf '%s\n' 'WIUNIX Academy: QUIC lab' | sudo tee '/var/www/academy-quic/index.html'
sudo chmod 644 '/var/www/academy-quic/index.html'
sudo restorecon -RFv '/var/www/academy-quic'
sudo '/opt/nginx-quic/sbin/nginx' -t
sudo systemctl daemon-reload
sudo systemctl enable --now academy-nginx-quic
systemctl is-active academy-nginx-quic
ps -eo user,pid,ppid,args | grep '[n]ginx'
ps -eZ | grep nginx
How do I know it worked?

The dedicated unit is active, workers use academy-nginx and the demo file is readable. On enforcing RPM verify httpd_t confinement. External HTTP is checked in the later client panel.

Inspect the active firewall

Use this inspection on a host already managed by UFW. Read the current status and rules. If another manager is active, inspect that manager instead; do not switch firewall managers.

Bash

VM; existing firewalld active-zone inspection

sudo firewall-cmd --state
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --list-all-zones

Allow only the required web transports

Only with existing active firewalld: select the public interface’s actual zone from the previous output, not a guessed default. Add these three ports to runtime and permanent policy without reload/restart. Stop if zone/interface ownership is unclear; preserve SSH, source restrictions and provider policy.

Bash

Server terminal · existing active UFW only

read -r -p 'Existing active zone for the public interface: ' web_zone
test -n "$web_zone" || exit 1
sudo firewall-cmd --get-zones | tr ' ' '\n' | grep -Fx -- "$web_zone" >/dev/null || exit 1
for transport in 80/tcp 443/tcp 443/udp; do
  sudo firewall-cmd --zone="$web_zone" --add-port="$transport" || exit 1
  sudo firewall-cmd --permanent --zone="$web_zone" --add-port="$transport" || exit 1
done
sudo firewall-cmd --zone="$web_zone" --list-ports
Explore all tutorials ↗