Nginx 404 in subfolder

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
leonvdkolk
Registered User
Posts: 9
Joined: Fri Aug 10, 2018 8:16 am

Re: Nginx 404 in subfolder

Post by leonvdkolk »

Mick wrote: Sun Aug 12, 2018 11:56 am Have you spoken to nginx support as suggested?
No i haven't. Where should i ask this?
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26455
Joined: Fri Aug 29, 2008 9:49 am

Re: Nginx 404 in subfolder

Post by Mick »

  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
leonvdkolk
Registered User
Posts: 9
Joined: Fri Aug 10, 2018 8:16 am

Re: Nginx 404 in subfolder

Post by leonvdkolk »

I fixed it myself by using the following directives...

Code: Select all

location /forum/ {
    try_files $uri $uri/ @rewriteapp;

    # Deny access to internal phpbb files.
    location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
        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/ /forum/app.php$is_args$args;
        fastcgi_pass unix:/var/lib/php7.0-fpm/web17.sock;
    }
}

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



        # Correctly pass scripts for installer
        location /forum/install/ {
            # phpBB uses index.htm
            try_files $uri $uri/ @rewrite_installapp;

            # 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/ /forum/install/app.php$is_args$args;
                fastcgi_pass unix:/var/lib/php7.0-fpm/web17.sock;
                }
        }

        location @rewrite_installapp {
            rewrite ^(.*)$ /forum/install/app.php/$1 last;
        }
Post Reply

Return to “[3.2.x] Support Forum”