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 » Sun Aug 12, 2018 6:09 pm

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: 19718
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably . . .

Re: Nginx 404 in subfolder

Post by Mick » Mon Aug 13, 2018 7:35 am

"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.

leonvdkolk
Registered User
Posts: 9
Joined: Fri Aug 10, 2018 8:16 am

Re: Nginx 404 in subfolder

Post by leonvdkolk » Mon Aug 13, 2018 12:36 pm

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”

Who is online

Users browsing this forum: Bauer, eastender lee, stevemaury and 21 guests