This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| nextcloud-install [2020/10/21 23:24] – created gwsadmin | nextcloud-install [2023/05/17 22:52] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| + | |||
| + | * Download & extract | ||
| + | |||
| + | <code bash> | ||
| + | wget https:// | ||
| + | |||
| + | sudo unzip nextcloud-x.x.x.zip -d / | ||
| + | sudo chown www-data: | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Setup MYSQL User/ | ||
| + | |||
| + | <code bash> | ||
| + | sudo mysql | ||
| + | |||
| + | create database nextcloud; | ||
| + | create user nextcloud@localhost identified by ' | ||
| + | grant all privileges on nextcloud.* to nextclouduser@localhost identified by ' | ||
| + | flush privileges; | ||
| + | exit; | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Create an Nginx Config File for Nextcloud | ||
| + | |||
| + | <code bash> | ||
| + | server { | ||
| + | listen 80; | ||
| + | listen [::]:80; | ||
| + | server_name example.com; | ||
| + | |||
| + | # Add headers to serve security related headers | ||
| + | add_header X-Content-Type-Options nosniff; | ||
| + | add_header X-XSS-Protection "1; mode=block"; | ||
| + | add_header X-Robots-Tag none; | ||
| + | add_header X-Download-Options noopen; | ||
| + | add_header X-Permitted-Cross-Domain-Policies none; | ||
| + | add_header Referrer-Policy no-referrer; | ||
| + | |||
| + | #I found this header is needed on Ubuntu, but not on Arch Linux. | ||
| + | add_header X-Frame-Options " | ||
| + | |||
| + | # Path to the root of your installation | ||
| + | root / | ||
| + | |||
| + | access_log / | ||
| + | error_log / | ||
| + | |||
| + | location = /robots.txt { | ||
| + | allow all; | ||
| + | log_not_found off; | ||
| + | access_log off; | ||
| + | } | ||
| + | |||
| + | # The following 2 rules are only needed for the user_webfinger app. | ||
| + | # Uncomment it if you're planning to use this app. | ||
| + | #rewrite ^/ | ||
| + | #rewrite ^/ | ||
| + | # last; | ||
| + | |||
| + | location = / | ||
| + | return 301 $scheme:// | ||
| + | } | ||
| + | location = / | ||
| + | | ||
| + | } | ||
| + | |||
| + | location ~ / | ||
| + | allow all; | ||
| + | } | ||
| + | |||
| + | # set max upload size | ||
| + | client_max_body_size 1024M; | ||
| + | fastcgi_buffers 64 4K; | ||
| + | |||
| + | # Disable gzip to avoid the removal of the ETag header | ||
| + | gzip off; | ||
| + | |||
| + | # Uncomment if your server is build with the ngx_pagespeed module | ||
| + | # This module is currently not supported. | ||
| + | #pagespeed off; | ||
| + | |||
| + | error_page 403 / | ||
| + | error_page 404 / | ||
| + | |||
| + | location / { | ||
| + | | ||
| + | } | ||
| + | |||
| + | location ~ ^/ | ||
| + | deny all; | ||
| + | } | ||
| + | location ~ ^/ | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location ~ ^/ | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | # | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | location ~ ^/ | ||
| + | | ||
| + | index index.php; | ||
| + | } | ||
| + | |||
| + | # Adding the cache control header for js and css files | ||
| + | # Make sure it is BELOW the PHP block | ||
| + | location ~* \.(?: | ||
| + | try_files $uri / | ||
| + | add_header Cache-Control " | ||
| + | # Add headers to serve security related headers (It is intended to | ||
| + | # have those duplicated to the ones above) | ||
| + | add_header X-Content-Type-Options nosniff; | ||
| + | add_header X-XSS-Protection "1; mode=block"; | ||
| + | add_header X-Robots-Tag none; | ||
| + | add_header X-Download-Options noopen; | ||
| + | add_header X-Permitted-Cross-Domain-Policies none; | ||
| + | add_header Referrer-Policy no-referrer; | ||
| + | # Optional: Don't log access to assets | ||
| + | access_log off; | ||
| + | } | ||
| + | |||
| + | | ||
| + | try_files $uri / | ||
| + | # Optional: Don't log access to other assets | ||
| + | access_log off; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Test and reload Nginx | ||
| + | |||
| + | <code bash> | ||
| + | sudo nginx -t | ||
| + | sudo systemctl reload nginx | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Install and enable PHP modules | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt install php-imagick php7.4-common php7.4-mysql php7.4-fpm php7.4-gd php7.4-json php7.4-curl | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Run Certbot | ||
| + | |||
| + | <code bash> | ||
| + | sudo certbot --nginx | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * Make the data directory | ||
| + | |||
| + | <code bash> | ||
| + | sudo mkdir / | ||
| + | |||
| + | sudo chown www-data: | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | * | ||
| + | |||
| + | Run setup | ||
| + | |||
| + | * Go to your domain name and run it from there | ||
| + | |||
| + | ===== Now to change some settings ===== | ||
| + | |||
| + | * Edit www.conf file and remove semi-colon from this line - ;clear_env = no | ||
| + | * Install Redis Cache | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt install redis-server | ||
| + | sudo systemctl start redis-server | ||
| + | sudo systemctl enable redis-server | ||
| + | sudo apt install php-redis | ||
| + | |||
| + | </ | ||
| + | * Add this to THE end of Nextcloud config config.php fund in nextcloud webdirectory/ | ||
| + | |||
| + | <code bash> | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | |||
| + | </ | ||
| + | * Restart Nginx and PHP | ||
| + | |||
| + | <code bash> | ||
| + | sudo systemctl restart nginx php7.4-fpm | ||
| + | |||
| + | </ | ||
| + | |||
| + | **For more information go to https:// | ||