Sure. Thanks KarlF12.
Prepare Installation
Flash Ubuntu Server 20.04 (for Raspberry Pi 4) Image to Micro-SDXC card
Insert Micro-SDXC card into Raspberry-Pi
Connect & Boot Raspberry Pi
Log In to Router to determine Raspberry Piâs MAC address
Configure Router to Assign static IP to Raspberry Pi (192.168.1.100)
Log Out of Router
Reboot R-Pi
Prepare Server
SSH into Pi (ubuntu@192.168.1.100)
change default password from âubuntuâ
sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo adduser Admin1
sudo usermod -aG sudo Admin1
sudo adduser Admin2
sudo usermod -aG sudo Admin2
sudo reboot
sudo deluser âremove-home ubuntu
cd /opt
sudo mkdir nextcloud
cd nextcloud
sudo mkdir data
cd âŠ
sudo chown -R www-data:www-data nextcloud
sudo apt install nginx
Now hereâs where I had my friend step in (Admin2) to help me set up SSH & Certificates for:
domain.dom
and
sub.domain.dom (which is where NextCloud installation will be)
We set the server to allow access to ports 80 and 443, and then redirect port 80 HTTP to 443 HTTPS. We checked that everything was working okay, and both sites were working correctly.
sudo apt install mariadb-server
sudo apt install php-fpm php-mysql
sudo reboot
Again, my friend took over and set up for PHP test on sub.domain.dom and PHP was working fine.
Then:
sudo /etc/init.d/mysql start
sudo mysql -uroot -p
CREATE USER âusernameâ@âlocalhostâ IDENTIFIED BY âpasswordâ;
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO âusernameâ@âlocalhostâ;
FLUSH PRIVILEGES;
Note that I did use the NextCloud username instead of âusernameâ here.
quit;
Next:
cd /var/www/html
sudo wget https://download.nextcloud.com/server/releases/nextcloud-19.0.3.tar.bz2
sudo wget https://download.nextcloud.com/server/releases/nextcloud-19.0.3.tar.bz2.sha256
sha256sum nextcloud-19.0.3.tar.bz2
cat nextcloud-19.0.3.tar.bz2.sha256
I verified that the checksums matched.
sudo tar xjfv nextcloud-19.0.3.tar.bz2
sudo chown -R www-data:www-data nextcloud
On the first attempt to get started⊠Where did I go wrong... again?
And then⊠Still having issues getting NextCloud installed - "Canât create or write into the data directory opt/nextcloud/dataâ - #2 by G-Wiz
And now after stopping NGINX and MYSQL and MYSQLD then:
cd /var/www/html
sudo mv nextcloud nextcloud.old
sudo tar xjfv nextcloud-19.0.3.tar.bz2
sudo chown -R www-data:www-data nextcloud
sudo reboot
And thatâs where I am now.
/var/www/html/nextcloud/index.html
> [!DOCTYPE html]
> [html]
> [head]
> [script] window.location.href=âindex.phpâ; [/script]
> [meta http-equiv=ârefreshâ content=â0; URL=index.phpâ]
> [/head]
> [/html]
/var/www/html/nextcloud/index.php
[?php
/**
- @copyright Copyright (c) 2016, ownCloud, Inc.
- @author Christoph Wurst [christoph@winzerhof-wurst.at]
- @author Joas Schilling [coding@schilljs.com]
- @author Jörn Friedrich Dreyer [jfd@butonic.de]
- @author Lukas Reschke [lukas@statuscode.ch]
- @author Morris Jobke [hey@morrisjobke.de]
- @author Robin Appelman [robin@icewind.nl]
- @author Roeland Jago Douma [roeland@famdouma.nl]
- @author Sergio BertolĂn [sbertolin@solidgear.es]
- @author Thomas MĂŒller [thomas.mueller@tmit.eu]
- @author Vincent Petry [pvince81@owncloud.com]
- @license AGPL-3.0
- This code is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License, version 3,
- as published by the Free Software Foundation.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License, version 3,
- along with this program. If not, see [Licenses - GNU Project - Free Software Foundation]
*/
require_once DIR . â/lib/versioncheck.phpâ;
try {
require_once DIR . â/lib/base.phpâ;
OC::handleRequest();
} catch (\OC\ServiceUnavailableException $ex) {
\OC::$server->getLogger()->logException($ex, [âappâ => âindexâ]);
//show the user a detailed error page
OC_Template::printExceptionErrorPage($ex, 503);
} catch (\OC\HintException $ex) {
try {
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
} catch (Exception $ex2) {
try {
\OC::$server->getLogger()->logException($ex, [âappâ => âindexâ]);
\OC::$server->getLogger()->logException($ex2, [âappâ => âindexâ]);
} catch (Throwable $e) {
// no way to log it properly - but to avoid a white page of death we try harder and ignore this one here
}
//show the user a detailed error page
OC_Template::printExceptionErrorPage($ex, 500);
}
} catch (\OC\User\LoginException $ex) {
OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex, [âappâ => âindexâ]);
//show the user a detailed error page
OC_Template::printExceptionErrorPage($ex, 500);
} catch (Error $ex) {
try {
\OC::$server->getLogger()->logException($ex, [âappâ => âindexâ]);
} catch (Error $e) {
http_response_code(500);
header(âContent-Type: text/plain; charset=utf-8â);
print(âInternal Server Error\n\nâ);
print(âThe server encountered an internal error and was unable to complete your request.\nâ);
print(âPlease contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\nâ);
print(âMore details can be found in the webserver log.\nâ);
throw $ex;
}
OC_Template::printExceptionErrorPage($ex, 500);
}
/etc/nginx/sites-available/sub.domain.dom
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php/php7.4-fpm.sock;
}
server {
listen 443 ssl;
server_name sub.domain.dom;
root /var/www/html/nextcloud/;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
added 2020 sep 05 - attempt to fix Cant create or write into the data directory opt/nextcloud/data Error message
location /data/ {
root /opt/nextcloud/data/;
}
commented above out 2020 sep 05 - unsuccessful
location / {
try_files $uri $uri/ =404;
}
managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.dom/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.dom/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
#}
server {
if ($host = sub.domain.dom) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 192.168.1.100:80;
server_name sub.domain.dom;
return 404; # managed by Certbot
#}
# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Default Cache-Control policy
expires 1m;
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The following 6 rules are borrowed from `.htaccess`
rewrite ^/\.well-known/host-meta\.json /public.php?service=host-meta-json last;
rewrite ^/\.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/\.well-known/webfinger /public.php?service=webfinger last;
rewrite ^/\.well-known/nodeinfo /public.php?service=nodeinfo last;
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
try_files $uri $uri/ =404;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files $uri /index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
I hope this is all helpful.