NextCloud using NGINX and UNIT

Peter TKATCHENKO peter at bimp.fr
Thu Apr 18 12:44:32 UTC 2019


Hi,

I'm trying to install NextCloud 15 using NGINX and UNIT.

I have a working instance of NextCloud 13 on NGINX and PHP-FPM, so the 
idea is to use the NGINX configuration from the working instance and 
slightly modify it to use UNIT and not PHP-FPM.

I have already installed WordPress with the same configuration (with 
UNIT), using the document from https://unit.nginx.org/howto/wordpress/

The problem is that there is no the ONE file (like in WordPress) that 
should process the requests not ending with *.php, there are SEVERAL 
files like this.

So in PHP-FPM config we use the following NGINX configuration to 
correctly route the traffic to PHP-FPM service:

location ~ 
^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) 
{
*fastcgi_split_path_info ^(.+\.php)(/.*)$;*
     include fastcgi_params;
*fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;*
     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_param HTTPS on;
     fastcgi_param modHeadersAvailable true;
     fastcgi_param front_controller_active true;
     fastcgi_pass php-handler;
     fastcgi_intercept_errors on;
     fastcgi_request_buffering off;
     fastcgi_send_timeout 120s;
     fastcgi_read_timeout 120s;
}

So, for example, the file /nextcloud/remote.php is used to process the 
requests like /nextcloud/remote.php/webdav/ and the requests like 
/nextcloud/ocs/v2.php/core/navigation/apps?absolute=true&format=json - 
are processed by /nextcloud/ocs/v2.php. The requests without script name 
(like /nextcloud/css/core/afde0962-server.css?v=152fab14-6) are still 
processed by /nextcloud/index.php

The configuration of UNIT is the following (inspired by your WordPress 
configuration):

{
     "listeners": {
         "*:8300": {
             "application": "nc_index"
         },

         "*:8301": {
             "application": "nc_direct"
         }
     },

     "applications": {
         "nc_index": {
             "type": "php",
             "processes": 20,
             "root": "/usr/local/www",
             "script": "nextcloud/index.php",
             "user": "www",
             "group": "www",
             "options": {
                 "file": "/usr/local/etc/php.ini",
                 "admin": {
                     "memory_limit": "1024M",
                     "upload_max_filesize": "4095M",
                     "max_input_vars": "2000",
                     "post_max_size": "4095M",
                     "max_execution_time": "600",
                     "variables_order": "EGPCS",
                     "expose_php": "0"
                 },
                 "user": {
                     "display_errors": "0"
                 }
             }
         },
         "nc_direct": {
             "type": "php",
             "processes": 20,
             "root": "/usr/local/www",
             "index": "nextcloud/index.php",
             "user": "www",
             "group": "www",
             "options": {
                 "file": "/usr/local/etc/php.ini",
                 "admin": {
                     "memory_limit": "1024M",
                     "upload_max_filesize": "4095M",
                     "max_input_vars": "2000",
                     "post_max_size": "4095M",
                     "max_execution_time": "600",
                     "variables_order": "EGPCS",
                     "expose_php": "0"
                 },
                 "user": {
                     "display_errors": "0"
                 }
             }
         }
     }
}

Could someone advise me in such configuration, please?

Best regards,

*Peter TKATCHENKO*


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20190418/9164fb72/attachment.html>


More information about the unit mailing list