Nextcloud 11 on Debian Jessie with Nginx / PHP / MySQL

1. Introduction

Nextcloud is an open source, self-hosted file sync and share and communication app platform. Access & sync your files, contacts, calendars and more.

Installation on a OVH server (Kimsufi) for testing purpose.

2. Installation and configuration

First,a quick system update :

Install the Nginx web server :

Install MySql database server:

Run the MySql secure installation :

Create a “nextcloud” database and a “nextcloud” user. Change the “PasswordToBeChanged” by a strong password !

Install PHP5 and everything required by NextCloud :

Edit the php.ini file :

And change the cgi.fix_pathinfo to 0 as below :

Restart the php-fpm daemon :

Edit a new virtual host for Nextcloud :

With the following content.
Replace the following :
– cloud.mydomain.fr : The domain you use for Nextcloud
– /etc/letsencrypt/…/fullchain.pem : Your Let’s Encrypt files
– /etc/letsencrypt/…/privkey.pem : Your Let’s Encrypt files

Check your Nginx configuration:

You should obtain something like :

If it’s ok, you can restart Nginx :

Go in the www directory :

Download Nextcloud :

And check the integrity :

Everything should be ok :

Install unzip if you don’t have it on your system :

Then we can unzip the downloaded file :

Once it’s done, open a browser and you’re done. You can then follow this procedure

3. Issues

On the admin page, you might have a few errors to be fixed.

3.1 getenv(“PATH”) only returns an empty response

php does not seem to be setup properly to query system environment variables. The test with getenv(“PATH”) only returns an empty response.
Please check the installation documentation ↗ for php configuration notes and the php configuration of your server, especially when using php-fpm.

Edit the following file :

And uncomment the “env[PATH]” line as below :

Then restart the php-fpm daemon :

3.2 The “Strict-Transport-Security” HTTP header is not configured to at least “15552000” seconds.

The “Strict-Transport-Security” HTTP header is not configured to at least “15552000” seconds. For enhanced security we recommend enabling HSTS as described in our security tips.

Edit your Nextcloud virtual host configuration file:

Uncomment the following lines :

Check your Nginx configuration:

You should obtain something like :

If it’s ok, you can restart Nginx :

4 thoughts on “Nextcloud 11 on Debian Jessie with Nginx / PHP / MySQL”

  1. Thanks.
    I always used Debian in the past and then I set up centos also. Everything was fine and dandy until I went for nextcloud. I did get it running in centos but it took some heavy work and a week of my time (2 hours/day), then I upgraded to nextcloud 11 and got so many issues. Finally I gave up centos even though I like it a lot and went back to my stable Debian and read through your things. My Debian server is quite heavily modified but I got nextcloud running in less then an 1 hour and as I want. Thank you for the tips and tricks. It helped a lot.

  2. Thanks for this guide,

    one small correction, I had to enable the nginx conf using :

    sudo ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/nextcloud

    1. Thanks Clément. I was creating a configuration file from scratch, but it’s good to know !

Leave a Reply

Your email address will not be published. Required fields are marked *