phpBB 3.2 nginx config

Hi I’m fairly new (again) to phpBB forum, why? because I never use it since 14years ago.

For those who are looking for the nginx configuration, i’m sharing mine below

I’ve omitted the part of the installer location block.

To those who will be installing from scratch, you will need to add the installer location block, please google it.

Please take note as well on the “# rewrite for SEO PLugin” part , .

rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html /viewtopic.php?f=$2&t=$4&start=$5&$query_string last;
rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*).html /viewtopic.php?f=$2&t=$4&$query_string last;
rewrite ^/(.*)-f([0-9]*)/index-s([0-9]*).html /viewforum.php?f=$2&start=$3&$query_string last;
rewrite ^/(.*)-f([0-9]*)/ /viewforum.php?f=$2&$query_string last;
rewrite ^/(.*)-f([0-9]*) /viewforum.php?f=$2&$query_string last;

This is for the requirement for SEO url extension from https://github.com/tas2580/seourls, therefore remove it if you don’t plan to use the extension.

   # The actual board domain.
    server {
        #listen 80;
        server_name yourdomain.com;
        client_max_body_size 20m;

        root /path/to/your/phpbb;

        location / {
           # phpBB uses index.htm
           index index.php index.htm index.html;
           # rewrite for SEO PLugin
           rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html /viewtopic.php?f=$2&t=$4&start=$5&$query_string last;
           rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*).html /viewtopic.php?f=$2&t=$4&$query_string last;
           rewrite ^/(.*)-f([0-9]*)/index-s([0-9]*).html /viewforum.php?f=$2&start=$3&$query_string last;
           rewrite ^/(.*)-f([0-9]*)/ /viewforum.php?f=$2&$query_string last;
           rewrite ^/(.*)-f([0-9]*) /viewforum.php?f=$2&$query_string last;
           try_files $uri $uri/ @rewriteapp;
        }

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

        # Deny access to internal phpbb files.
        location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
            deny all;
            # deny was ignored before 0.8.40 for connections over IPv6.
            # Use internal directive to prohibit access on older versions.
            internal;
        }

        # Pass the php scripts to fastcgi server specified in upstream declaration.
        location ~ \.php(/|$) {
            # Unmodified fastcgi_params from nginx distribution.
            include fastcgi_params;
            # Necessary for php.
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT $realpath_root;
            try_files $uri $uri/ /app.php$is_args$args;
            fastcgi_pass 127.0.0.1:9000;
        }

        # Deny access to version control system directories.
        location ~ /\.svn|/\.git {
            deny all;
            internal;
        }
    }