ยง2024-05-04, hc4nas02.yushei.net, 20.04.6 LTS (Focal Fossa), raid-1, iT
- install nexcloud
$ sudo apt install snapd && sudo apt install nextcloud`
- at this machin, 80 prt was redireted to 8080
- change nextcloud http, https port
$ sudo snap stop nextcloud
$ snap services | grep active
certbot.renew enabled inactive timer-activated
nextcloud.apache enabled inactive -
nextcloud.logrotate enabled inactive timer-activated
nextcloud.mysql enabled inactive -
nextcloud.nextcloud-cron enabled inactive -
nextcloud.nextcloud-fixer enabled inactive -
nextcloud.php-fpm enabled inactive -
nextcloud.redis-server enabled inactive -
nextcloud.renew-certs enabled inactive -
- change http, https ports
$ sudo snap stop nextcloud
$ sudo snap set nextcloud ports.http=43101
$ sudo snap set nextcloud ports.https=43103
$ sudo snap start nextcloud
$ sudo snap get nextcloud
Key Value
http {...} // The {...} in the output indicates that there are further options beneath the current key name level.
mode production
nextcloud {...}
php {...}
ports {...}
private {...}
alexlai@hc4nas02:~$ sudo snap get nextcloud ports
Key Value
ports.http 43101
ports.https 43103
- start nextcloud
snap start
then create admin account, and install APPS
- nginx server `/etc/ngnix/sites-available/upstream-43103 as
# port 43103, NexClud@hc4nas01.yushei.net:43103
upstream NextCloud-01 {
server hc4nas02.yushei.net:43101 weight=1;
# server 192.168.2.197:43410 weight=1;
}
server {
server_name hc4nas02.yushei.net:43103;
charset utf-8;
location / {
proxy_pass http://NextCloud-01;
}
listen 43103 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/munetaka.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/munetaka.me/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
}
$ pwd
/etc/nginx/sites-enabled
$ sudo ln -sf /etc/nginx/sites-avaliable/upstream-43101 upstream-43101
$ sudo systemctl restart nginx
- modify /var/snap/nextcloud/current/nextcloud/config/config.php
-
stop
sudo snap stop nextcloud
-
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php
and add these lines
alexlai@hc4nas02:~$ sudo nextcloud.disable-https
2024/05/04 19:54:39.482584 cmd_run.go:1072: WARNING: cannot create user data directory: failed to verify SELinux context of /root/snap: exec: "matchpathcon": executable file not found in $PATH
HTTPS doesn't seem enabled
- 2024-05-04, this currently will work except SSL,
<?php
$CONFIG = array (
'apps_paths' =>
array (
0 =>
array (
'path' => '/snap/nextcloud/current/htdocs/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
'url' => '/extra-apps',
'writable' => true,
),
),
'supportedDatabases' =>
array (
0 => 'mysql',
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
'memcache.local' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/tmp/sockets/redis.sock',
'port' => 0,
),
'log_type' => 'file',
'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
'logfilemode' => 416,
'instanceid' => 'ocge3fugzyu9',
'passwordsalt' => 'vR2ft2qNhmUaXjJv4d8N/xwVNIiiuS',
'secret' => '8CFpLjgC9xAIH6U8hnPgnaO8XxZR/1RXhW8IfkOi2ySZ7upP',
'trusted_domains' =>
array (
0 => '192.168.16.247',
1 => 'hc4nas02.yushei.net',
2 => 'munetaka.me',
),
'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
'dbtype' => 'mysql',
'version' => '27.1.8.1',
'overwrite.cli.url' => 'http://192.168.16.247:43101',
'dbname' => 'nextcloud',
'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => 'jRJ6hI5Fi64vbU6AWjt2m66RaQh0YPeplRTNl2_8VUOXLQM_3CRYt82b2QbkbWXK',
'installed' => true,
'maintenance' => false,
'trusted_proxies' =>
array (
0 => 'munetaka.me',
),
'overwritewebroot' => '/',
'overwritehost' => 'hc4nas02.yushei.net:43101',
'allow_local_remote_servers' => true,
);
- freshly installled, /var/snap/nextcloud/current/nextcloud/config/config.php
<?php
$snap_current = getenv('SNAP_CURRENT');
$snap_data_current = getenv('SNAP_DATA_CURRENT');
$CONFIG = array(
/**
* Use the ``apps_paths`` parameter to set the location of the Apps directory,
* which should be scanned for available apps, and where user-specific apps
* should be installed from the Apps store. The ``path`` defines the absolute
* file system path to the app folder. The key ``url`` defines the HTTP web path
* to that folder, starting from the Nextcloud web root. The key ``writable``
* indicates if a web server can write files to that folder.
*/
'apps_paths' => array(
/**
* These are the default apps shipped with Nextcloud. They are read-only.
*/
array(
'path'=> $snap_current.'/htdocs/apps',
'url' => '/apps',
'writable' => false,
),
/**
* This directory is writable, meant for apps installed by the user.
*/
array(
'path'=> $snap_data_current.'/nextcloud/extra-apps',
'url' => '/extra-apps',
'writable' => true,
),
),
/**
* Database types that are supported for installation.
*
* Available:
* - sqlite (SQLite3 - Not in Enterprise Edition)
* - mysql (MySQL)
* - pgsql (PostgreSQL)
* - oci (Oracle - Enterprise Edition Only)
*/
'supportedDatabases' => array(
'mysql',
),
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
'host' => getenv('REDIS_SOCKET'),
'port' => 0,
),
'log_type' => 'file',
'logfile' => $snap_data_current.'/logs/nextcloud.log',
'logfilemode' => 0640,
);