New 3.2.X installer does not work under nginx + PHP7?

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
User avatar
Gwyneth Llewelyn
Registered User
Posts: 4
Joined: Thu May 19, 2016 4:39 pm

New 3.2.X installer does not work under nginx + PHP7?

Post by Gwyneth Llewelyn »

This is more a question than pointing out a bug or missing feature...

phpBB plays nicely with nginx until at least 3.1.9. With 3.2.X I understand that there is a completely new process of managing the updates. The /install directory, instead of 3.1.X's index.php -> database_update.php method, now has a brand new way of dealing with the installation: app.php (I guess it's the same logic that is used for managing extensions).

Sadly, though, the volunteers coding app.php presume that all web servers will correctly parse paths like /.../app.php/update. This is not the case — most people searching the Web for a phpBB3 configuration file for nginx will get something like this: http://nginxlibrary.com/phpbb-configuration/

There is something extra that is needed. I got the inspiration from https://www.phpbb.com/community/viewtop ... &t=2294581 which fixes the ability to add extensions. To get the install working add this snippet before any other rules:

Code: Select all

        location /install/app.php {
                try_files $uri $uri/ /install/app.php?$query_string;
        }
I would like to suggest that there is a bit more information on the 'update' panel regarding the extra configuration for those who are upgrading from 3.1.X to 3.2.X.

User avatar
Gwyneth Llewelyn
Registered User
Posts: 4
Joined: Thu May 19, 2016 4:39 pm

Re: New 3.2.X installer does not work under nginx + PHP7?

Post by Gwyneth Llewelyn »

Quick correction: where I wrote 'before any other rules' I obviously meant 'before any other rules regarding PHP processing'...

User avatar
sitesplat
Registered User
Posts: 8
Joined: Wed Dec 10, 2014 4:28 pm

Re: New 3.2.X installer does not work under nginx + PHP7?

Post by sitesplat »

Try something like this and see if it helps:

Code: Select all

 1 # Sample nginx configuration file for phpBB.
    2 # Global settings have been removed, copy them
    3 # from your system's nginx.conf.
    4 # Tested with nginx 0.8.35.
    5 
    6 # If you want to use the X-Accel-Redirect feature,
    7 # add the following to your config.php.
    8 #
    9 #  define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
   10 #
   11 # See http://wiki.nginx.org/XSendfile for the details
   12 # on X-Accel-Redirect.
   13 
   14 http {
   15     # Compression - requires gzip and gzip static modules.
   16     gzip on;
   17     gzip_static on;
   18     gzip_vary on;
   19     gzip_http_version 1.1;
   20     gzip_min_length 700;
   21     
   22     # Compression levels over 6 do not give an appreciable improvement
   23     # in compression ratio, but take more resources.
   24     gzip_comp_level 6;
   25     
   26     # IE 6 and lower do not support gzip with Vary correctly.
   27     gzip_disable "msie6";
   28     # Before nginx 0.7.63:
   29     #gzip_disable "MSIE [1-6]\.";
   30 
   31     # Catch-all server for requests to invalid hosts.
   32     # Also catches vulnerability scanners probing IP addresses.
   33     server {
   34         # default specifies that this block is to be used when
   35         # no other block matches.
   36         listen 80 default;
   37 
   38         server_name bogus;
   39         return 444;
   40         root /var/empty;
   41     }
   42 
   43     # If you have domains with and without www prefix,
   44     # redirect one to the other.
   45     server {
   46         # Default port is 80.
   47         #listen 80;
   48 
   49         server_name myforums.com;
   50 
   51         # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
   52         rewrite ^ http://www.myforums.com$request_uri permanent;
   53         # Equivalent to:
   54         #rewrite ^(.*)$ http://www.myforums.com$1 permanent;
   55     }
   56 
   57     # The actual board domain.
   58     server {
   59         #listen 80;
   60         server_name www.myforums.com;
   61 
   62         root /path/to/phpbb;
   63 
   64         location / {
   65             # phpbb uses index.htm
   66             index index.php index.html index.htm;
   67             try_files $uri $uri/ @rewriteapp;
   68         }
   69 
   70         location @rewriteapp {
   71             rewrite ^(.*)$ /app.php/$1 last;
   72         }
   73 
   74         # Deny access to internal phpbb files.
   75         location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
   76             deny all;
   77             # deny was ignored before 0.8.40 for connections over IPv6.
   78             # Use internal directive to prohibit access on older versions.
   79             internal;
   80         }
   81 
   82         # Pass the php scripts to fastcgi server specified in upstream declaration.
   83         location ~ \.php(/|$) {
   84             # Unmodified fastcgi_params from nginx distribution.
   85             include fastcgi_params;
   86             # Necessary for php.
   87             fastcgi_split_path_info ^(.+\.php)(/.*)$;
   88             fastcgi_param PATH_INFO $fastcgi_path_info;
   89             fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
   90             fastcgi_param DOCUMENT_ROOT $realpath_root;
   91             try_files $uri $uri/ /app.php$is_args$args;
   92             fastcgi_pass php;
   93         }
   94 
   95         # Deny access to version control system directories.
   96         location ~ /\.svn|/\.git {
   97             deny all;
   98             internal;
   99         }
  100     }
  101 
  102     # If running php as fastcgi, specify php upstream.
  103     upstream php {
  104         server unix:/tmp/php.sock;
  105     }
  106 }
- FLATBOOTS - phpBB Flat Design - Bootstrap3
- Contact me Via PM or e-mail for Custom work
- Deploy an SSD cloud server in 55 seconds. Sign up and get $10 in credit.

User avatar
3Di
Registered User
Posts: 762
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano (I) Frankfurt (D)
Contact:

Re: New 3.2.X installer does not work under nginx + PHP7?

Post by 3Di »

3.2.0-RC1 : /docs/nginx.sample.conf

https://github.com/phpbb/phpbb/pull/419 ... 428a4fbb4b
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
Gwyneth Llewelyn
Registered User
Posts: 4
Joined: Thu May 19, 2016 4:39 pm

Re: New 3.2.X installer does not work under nginx + PHP7?

Post by Gwyneth Llewelyn »

@sitesplat, yes, that ought to work. Unfortunately I'm slightly impaired in the amount of changes I can make on the configuration file (I'm using ISPConfig to manage the many sites — deliberately, by choice, just because I wish a more standard way to deal with all of them); however, your solution ought to be more than fine.

@3Di — how did I miss that configuration file completely?? I guess I didn't search the GitHub tickets. My fault. Although sitesplat's solution is more elegant and deals with app.php outside the install directory as well (i.e. for dealing with extensions, etc. — even though I have no idea about performance differences). In any case, it would be awesome if these pointers were available on some kind of document, file, webpage, etc. Hopefully that could be quickly added for the final release version. I'm thinking of a NGINX-INSTALL.txt, clearly visible for new installs and upgrades, that points to a working Nginx configuration.

Thanks so much for your help. I wish I could add some kudos to you!

Post Reply