Board Index β€Ί Knowledge Base β€Ί Installation & Migration β€Ί Configuring LiteSpeed & Nginx Web Servers for phpBB SEO Fast URL Rewriting

Configuring LiteSpeed & Nginx Web Servers for phpBB SEO Fast URL Rewriting

Production-ready Nginx server blocks and LiteSpeed OpenLiteSpeed rewrite rules for lightning-fast URL rewriting, HTTP/3, and zero overhead.

While Apache with mod_rewrite remains the standard deployment environment for phpBB, high-traffic communities frequently deploy LiteSpeed Web Server (LSWS) or Nginx for superior concurrency, lower memory footprints, and native HTTP/3 support.

This technical guide provides verified, production-ready rewrite configurations for both LiteSpeed and Nginx environments running the phpBB SEO Framework.

1. LiteSpeed Web Server Configuration

A. LiteSpeed Enterprise
LiteSpeed Enterprise features native .htaccess compatibility. The standard phpBB .htaccess file works out-of-the-box without manual syntax translation. Any changes made to .htaccess take effect immediately.

B. OpenLiteSpeed (OLS)
OpenLiteSpeed supports Apache rewrite syntax, but does not monitor .htaccess modifications in real time. To configure OpenLiteSpeed:
  1. In OpenLiteSpeed WebAdmin console, navigate to Virtual Hosts -> Your Host -> Rewrite.
  2. Set Enable Rewrite to Yes.
  3. Set Auto Load from .htaccess to Yes.
  4. In the Rewrite Rules box, insert:

    Code: Select all

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /app.php/$1 [QSA,L]
  5. Perform a Graceful Restart of OpenLiteSpeed for the rules to take effect.
2. High-Performance Nginx Server Block
Unlike Apache, Nginx does not use .htaccess. All URL rewrite routing must be defined in your domain's server block.

Here is the complete, secure Nginx configuration for phpBB with SEO permalinks:

Code: Select all

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com example.com;
    root /var/www/html/phpbb;
    index index.php index.html index.htm;

    # SEO Permalinks & Fast App Routing
    location / {
        try_files $uri $uri/ @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    # Pass PHP scripts to FastCGI (PHP-FPM)
    location ~ \.php(/|$) {
        include fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_intercept_errors on;
    }

    # Security: Deny access to internal phpBB directories and files
    location ~ /(config\.php|common\.php|cache|files|store|images/avatars/upload) {
        deny all;
        internal;
    }

    # Deny dotfiles (.htaccess, .git, etc.)
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Aggressive caching for static assets
    location ~* \.(jpg|jpeg|gif|png|webp|svg|css|js|ico|woff2?)$ {
        expires 30d;
        add_header Cache-Control "public, no-transform";
        access_log off;
    }
}
3. Verifying HTTP Headers and HTTP/3
After reloading Nginx (sudo nginx -t && sudo systemctl reload nginx) or restarting LiteSpeed, verify that rewritten URLs respond with HTTP 200:

Code: Select all

curl -I https://www.example.com/topic/sample-topic-1/
Verify that the response includes:
  • HTTP/2 200 or HTTP/3 200
  • Clean <link rel="canonical"> in HTML output
  • Zero redundant redirect hops
4. Web Server Tuning Discussions
Have questions about Nginx FastCGI microcaching or LiteSpeed LSCache rules? Join our technical discussion:
💬 phpBB Server Administration & Performance Forum

Share this article

Share this guide with your network and community.

Was this article helpful?
Login to vote.