NextCloud is like your own Dropbox. Possibly you know about OwnCloud. That OwnCloud’s founder have quit to start up a new fork and a new company called NextCloud. OwnCloud had 2 types of softwares – free and paid. NextCloud is different than OwnCloud at some points, has no paid software but paid hosting. Here Are the Steps to Install NextCloud on Cloud Server With Nginx Server, Redis Cache, 2 FA, HTTPS.
NextCloud Official Resources
You’ll not need the resources at all, yet we are giving the appropriate resources for advance configuration, optimisation, bug reporting etc :
1 2 | https://github.com/nextcloud/server https://docs.nextcloud.com/server/11/admin_manual/installation/index.html |
Steps to Install NextCloud on Cloud Server
We are using Ubuntu 16.04 LTS as server OS. Follow this guide up to step 2.3 on the table of contents to create a LEMP server. If you are using CentOS, simply use CentMinMod script to create LEMP server. Also create a database, database user following that guide.
---
So we are starting with Nginx, MySQL installed on server. First install Redis :
1 2 | apt install redis-server php7.0-redis nano /etc/redis/redis.conf |
Change the maximum memory size. Run these commands :
1 2 3 4 | service redis-server restart service nginx restart service php7.0-fpm restart redis-cli monitor |
We need to add binlog-format = mixed
on my.cnf
:
1 2 3 4 | nano /etc/mysql/my.cnf # in the [mysqld] block add # binlog-format = mixed service mysql restart |
Our default config file i.e. /etc/nginx/sites-enabled/default
should look like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | server { listen 80; server_name example.com; return 301 https://example.com$request_uri; location '/.well-known/acme-challenge' { root /var/www/html/example.com; allow all; try_files $uri /$1;} } server { listen 443 ssl http2; server_name example.com; root /var/www/html/example.com; index index.php index.html index.htm; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ecdh_curve secp384r1; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305-D:ECDHE-RSA-CHACHA20-POLY1305-D:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384'; ssl_prefer_server_ciphers on; ssl_certificate /etc/nginx/ssl/example.com/privatekey.key; ssl_certificate_key /etc/nginx/ssl/example.com/chain.pem; ssl_trusted_certificate /etc/nginx/ssl/example.com/chain.pem; ssl_stapling on; ssl_stapling_verify on; resolver 8.8.4.4 8.8.8.8 valid=300s; resolver_timeout 5s; add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"; add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" always; add_header X-Content-Type-Options nosniff always; add_header X-Xss-Protection "1; mode=block" always; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; location = /robots.txt { allow all; log_not_found off; access_log off; } location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; } client_max_body_size 512M; gzip off; error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php; location / { rewrite ^ /index.php$uri; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) { include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; #Avoid sending the security headers twice fastcgi_param modHeadersAvailable true; fastcgi_param front_controller_active true; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; } location ~ ^/(?:updater|ocs-provider)(?:$|/) { try_files $uri/ =404; index index.php; } location ~* \.(?:css|js)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control "public, max-age=7200"; access_log off; } location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args; access_log off; } location '/.well-known/acme-challenge' { root /var/www/html/example.com; allow all; try_files $uri /$1;} } |
How to install Let’s Encrypt SSL certificate that is written here. Follow those steps and comeback here after finishing!
1 2 3 4 5 6 | cd /var/www/html/ mkdir -p /var/www/html/example.com wget https://download.nextcloud.com/server/releases/nextcloud-11.0.0.zip unzip nextcloud-11.0.0.zip mv nextcloud example.com sudo chown -R www-data:www-data /var/www/html/example.com |
Now after restarting Nginx, open your domain/subdomain on browser which is example.com
here, there will be a web GUI based wizard.
We will now configure Redis as the cache server for Nextcloud :
1 2 3 4 5 6 7 8 9 10 11 12 | nano /var/www/html/example.com/config/config.php # populate with this data. Add the following lines above the last line with `);` : 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.local' => '\OC\Memcache\Redis', 'filelocking.enabled' => 'true', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => 'localhost', 'timeout' => 0, 'dbindex' => 0, 'port' => 6379, ), |
Nextcloud will give you option on Web GUI to encrypt the data and Two Factor Authentication.
Tagged With nextcloud redis , configure redis ubuntu nextcloud , paperuri:(09808239be5b39163a577db353dadd35) , install nextcloud server on windows , nextcloud , ngix redis nextcloud , nextcloud nginx redis , nextcloud 404 error nginx after install , nextcloud 11 debian php7 https nginx , x-robots-tag none