Resource icon

Scripted installation of Nextcloud 28 in iocage jail 2018-03-23

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Hello and thank you for the great guide.

I’ve decided to use your script since I had been using Nextcloud installed from plugins and it finally broke for good.

I need your help for setting it up behind my own reverse proxy: I’m not using caddy and I have my own jail running nginx, I had the previous instance running just fine by adding the trusted domain in the config.php.

Since I’m getting a “bad gateway”, is there anything I should modify further? Any help would be greatly appreciated. Cheers
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Hello and thank you for the great guide.

I’ve decided to use your script since I had been using Nextcloud installed from plugins and it finally broke for good.

I need your help for setting it up behind my own reverse proxy: I’m not using caddy and I have my own jail running nginx, I had the previous instance running just fine by adding the trusted domain in the config.php.

Since I’m getting a “bad gateway”, is there anything I should modify further? Any help would be greatly appreciated. Cheers
Because this script configures Nextcloud using caddy, you will need to add the “servers” block to the first set of brackets in the Caddyfile located at /usr/local/www/Caddyfile

Code:
{
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email youremail@mail.com
        servers {
                trusted_proxies static 192.168.1.100
        }
}


Obviously set the IP to the address of your proxy server.
Also make sure your overwrite rules are properly set in the config.php
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Because this script configures Nextcloud using caddy, you will need to add the “servers” block to the first set of brackets in the Caddyfile located at /usr/local/www/Caddyfile

Code:
{
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email youremail@mail.com
        servers {
                trusted_proxies static 192.168.1.100
        }
}


Obviously set the IP to the address of your proxy server.
Also make sure your overwrite rules are properly set in the config.php

Thank you for helping me, my reverse proxy is located at 192.168.1.18 and NC @ 192.168.1.173.

Would the following work?
Code:
{
    # debug
}
{
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email mymail@gmail.com
        servers {
                trusted_proxies static 192.168.1.18
        }
}
192.168.1.173:80, 192.168.1.173:80 {
    root * /usr/local/www/nextcloud
    file_server
    log {
        output file /var/log/192.168.1.173.log
    }

    php_fastcgi 127.0.0.1:9000 {
        env front_controller_active true
    }

    # client support (e.g. os x calendar / contacts)
    redir /.well-known/carddav /remote.php/dav 301
    redir /.well-known/caldav /remote.php/dav 301
    redir /.well-known/webfinger /index.php/.well-known/webfinger 301
    redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301

    # .htaccess / data / config / ... shouldn't be accessible from outside
    @forbidden {
        path /.htaccess
        path /data/*
        path /config/*
        path /db_structure
        path /.xml
        path /README
        path /3rdparty/*
        path /lib/*
        path /templates/*
        path /occ
        path /console.php
    }

    respond @forbidden 404
}
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Thank you for helping me, my reverse proxy is located at 192.168.1.18 and NC @ 192.168.1.173.

Would the following work?
Code:
{
    # debug
}
{
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email mymail@gmail.com
        servers {
                trusted_proxies static 192.168.1.18
        }
}
192.168.1.173:80, 192.168.1.173:80 {
    root * /usr/local/www/nextcloud
    file_server
    log {
        output file /var/log/192.168.1.173.log
    }

    php_fastcgi 127.0.0.1:9000 {
        env front_controller_active true
    }

    # client support (e.g. os x calendar / contacts)
    redir /.well-known/carddav /remote.php/dav 301
    redir /.well-known/caldav /remote.php/dav 301
    redir /.well-known/webfinger /index.php/.well-known/webfinger 301
    redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301

    # .htaccess / data / config / ... shouldn't be accessible from outside
    @forbidden {
        path /.htaccess
        path /data/*
        path /config/*
        path /db_structure
        path /.xml
        path /README
        path /3rdparty/*
        path /lib/*
        path /templates/*
        path /occ
        path /console.php
    }

    respond @forbidden 404
}
No. Notice that you have only “#debug” in the first bracket block. In caddy, the first block is used for global settings for that instance. You should have it all in one block. (remove the debug block) or add it like this

Code:
{
        # debug
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email mymail@gmail.com
        servers {
                trusted_proxies static 192.168.1.18
        }
}

Everything inside the first bracket block is a global option. Caddy only allows one global block. The rest are called site blocks. Now, the “servers” block is INSIDE the global block so it works that way.

Also you only need your Nextcloud IP once in the domain section, I notice you have it there twice. You should probably have that set to nextcloud.domain.com:80 in addition to the IP

EDIT: make sure to service caddy reload when changing anything in caddy
 
Last edited:

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
No. Notice that you have only “#debug” in the first bracket block. In caddy, the first block is used for global settings for that instance. You should have it all in one block. (remove the debug block) or add it like this

Code:
{
        # debug
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
        email mymail@gmail.com
        servers {
                trusted_proxies static 192.168.1.18
        }
}

Everything inside the first bracket block is a global option. Caddy only allows one global block. The rest are called site blocks. Now, the “servers” block is INSIDE the global block so it works that way.

Also you only need your Nextcloud IP once in the domain section, I notice you have it there twice. You should probably have that set to nextcloud.domain.com:80 in addition to the IP

Ok, i feel we're moving in the right direction. I'm not getting a bad gateway anymore. I am getting a blank page tho.

This is what i have in my caddyfile
Code:
{
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    email mymail@gmail.com
}

192.168.1.173 {
    reverse_proxy 192.168.1.18:80 {
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Proto {scheme}
    }

    log {
        output file /var/log/192.168.1.173.log
    }

    encode gzip

    @forbidden {
        path /.htaccess
        path /data/*
        path /config/*
        path /db_structure
        path /.xml
        path /README
        path /3rdparty/*
        path /lib/*
        path /templates/*
        path /occ
        path /console.php
    }

    respond @forbidden 404
}


And this is my nginx setup for NC

Code:
server {
       listen 80;
        #listen [::]:80;
        server_name nextcloud.website.work;
        return 301 https://nextcloud.website.work$request_uri;
        }

    server {
        listen       443 ssl;
        #ssl on;
        server_name  nextcloud.website.work;
        ssl_certificate /usr/local/etc/letsencrypt/live/nextcloud.website.work/fullchain.pem;
        ssl_certificate_key /usr/local/etc/letsencrypt/live/nextcloud.website.work/privkey.pem;
        include ssl_common.conf;

    client_max_body_size 0;

        ssl_session_cache shared:SSL:10m;

    location / {
        proxy_pass https://192.168.1.173;
    proxy_redirect     off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host:443;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header X-Forwarded-Proto $scheme;

    location = /.well-known/webfinger {
    return 301 $scheme://$host:$server_port/index.php/.well-known/webfinger;
    }
    location = /.well-known/nodeinfo {
    return 301 $scheme://$host:$server_port/index.php/.well-known/nodeinfo;
    }
        
    rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ redirect;
    rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ redirect;       

        # Websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
    }
}
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Ok, i feel we're moving in the right direction. I'm not getting a bad gateway anymore. I am getting a blank page tho.

This is what i have in my caddyfile
Code:
{
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    email mymail@gmail.com
}

192.168.1.173 {
    reverse_proxy 192.168.1.18:80 {
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Proto {scheme}
    }

    log {
        output file /var/log/192.168.1.173.log
    }

    encode gzip

    @forbidden {
        path /.htaccess
        path /data/*
        path /config/*
        path /db_structure
        path /.xml
        path /README
        path /3rdparty/*
        path /lib/*
        path /templates/*
        path /occ
        path /console.php
    }

    respond @forbidden 404
}
Some issues here. Nextcloud is not the proxy, so having the reverse proxy directive insides the site block will not do anything. Here you are essentially telling Nextcloud to proxy back to your proxy. Remove the reverse_proxy directive and set it back to the global block.
And this is my nginx setup for NC

Code:
server {
       listen 80;
        #listen [::]:80;
        server_name nextcloud.website.work;
        return 301 https://nextcloud.website.work$request_uri;
        }

    server {
        listen       443 ssl;
        #ssl on;
        server_name  nextcloud.website.work;
        ssl_certificate /usr/local/etc/letsencrypt/live/nextcloud.website.work/fullchain.pem;
        ssl_certificate_key /usr/local/etc/letsencrypt/live/nextcloud.website.work/privkey.pem;
        include ssl_common.conf;

    client_max_body_size 0;

        ssl_session_cache shared:SSL:10m;

    location / {
        proxy_pass https://192.168.1.173;
    proxy_redirect     off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host:443;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header X-Forwarded-Proto $scheme;

    location = /.well-known/webfinger {
    return 301 $scheme://$host:$server_port/index.php/.well-known/webfinger;
    }
    location = /.well-known/nodeinfo {
    return 301 $scheme://$host:$server_port/index.php/.well-known/nodeinfo;
    }
      
    rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ redirect;
    rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ redirect;     

        # Websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
    }
}
The only thing you need in Nginx is to say proxy $FQDN to (nextcloudip)
The caddy server in nextclouds jail will handle all the rest.
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Basically there are 5 things to get right when reverse proxying to Nextcloud.

1. Nextcloud trusted_proxies need to be set to your proxy IP
2. Nextcloud overwritehost needs to be set to your FQDN
3. Your FQDN must resolve to your proxy
4. Caddy trusted_proxies must be set you your proxy IP
5. Your proxy must pass the correct header, and proxy to the correct port and IP

I had this all running a day ago, so I can confirm the Caddyfile I posted works, if everything else is set properly.

I was using another caddy instance as the proxy though, as I’m not too knowledgeable with nginx
 

wlevels

Cadet
Joined
Apr 12, 2023
Messages
7
The log file that will help the most would be at /var/log/caddy/caddy.log
Thanks for the tip. I looked through it and noticed there's issues trying to set the _acme-challenge record. However I already switched from my specific CloudFlare API key to the Global API key which has all the access, still getting an error. Any idea if this is Caddy or CloudFlare?

Code:
{"level":"info","ts":1686930154.0709136,"logger":"http.acme_client","msg":"trying to solve challenge","identifier":"nextcloud.int.mydomain.com","challenge_type":"dns-01","ca":"https://acme-staging-v02.api.letsencrypt.org/directory"}
{"level":"error","ts":1686930154.128713,"logger":"http.acme_client","msg":"cleaning up solver","identifier":"nextcloud.int.mydomain.com","challenge_type":"dns-01","error":"no memory of presenting a DNS record for \"_acme-challenge.nextcloud.int.mydomain.com\" (usually OK if presenting also failed)"}
{"level":"error","ts":1686930154.279986,"logger":"tls.obtain","msg":"could not get certificate from issuer","identifier":"nextcloud.int.mydomain.com","issuer":"acme-staging-v02.api.letsencrypt.org-directory","error":"[nextcloud.int.mydomain.com] solving challenges: presenting for challenge: could not determine zone for domain \"_acme-challenge.nextcloud.int.mydomain.com\": unexpected response code 'SERVFAIL' for _acme-challenge.nextcloud.int.mydomain.com. (order=https://acme-staging-v02.api.letsencrypt.org/acme/order/107113604/9284736104) (ca=https://acme-staging-v02.api.letsencrypt.org/directory)"}
 

victort

Guru
Joined
Dec 31, 2021
Messages
973

jhax

Dabbler
Joined
May 22, 2023
Messages
32
Greetings, me again. I am attempting to re-execute this using the same process as before. And I am getting the following error..

Code:
"error":"[myDomain.us] Obtain: [myDomain.us] solving challenges: presenting for challenge: adding temporary record for zone \"us.\": expected 1 zone, got 0 for us.


Now, along with this error I am given a URL
(order=https://acme-v02.api.letsencrypt.org/acme/order/##########/##########)

And when I go to the URL I am presented with the API from what I assume is letsencrypt

Code:
{
  "status": "invalid",
  "expires": "2023-06-25T02:30:23Z",
  "identifiers": [
    {
      "type": "dns",
      "value": "myDomain.us"
    }
  ],
  "authorizations": [
    "https://acme-v02.api.letsencrypt.org/acme/authz-v3/##########"
  ],
  "finalize": "https://acme-v02.api.letsencrypt.org/acme/finalize/##########/##########"
}


When I select the URL under authorizations I am taken to the following API

Code:
{
  "identifier": {
    "type": "dns",
    "value": "myDomain.us"
  },
  "status": "deactivated",
  "expires": "2023-06-25T02:30:23Z",
  "challenges": [
    {
      "type": "http-01",
      "status": "pending",
      "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/##########/KXhYNg",
      "token": "api_token"
    },
    {
      "type": "dns-01",
      "status": "pending",
      "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/##########/ZIMoZQ",
      "token": "api_token"
    },
    {
      "type": "tls-alpn-01",
      "status": "pending",
      "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/##########/bDjk5g",
      "token": "api_token"
    }
  ]
}

And when I select the URL next to finalize I am taken to the following API


Code:
{
  "type": "urn:ietf:params:acme:error:malformed",
  "detail": "Method not allowed",
  "status": 405
}


Would anyone happen to know what might be going on?

Thank you,
Justin
 
Last edited:

wlevels

Cadet
Joined
Apr 12, 2023
Messages
7

Does your DNS allow you to resolve using 1.1.1.1?
Thanks for the tip Victor,

Actually I had some bigger more general problems with my DNS, I moved to CloudFlare specifically when trying to deploy Nextcloud using this script. Once I fixed that, I noticed an error that it was unable to validate, which I was able to fix using 1.1.1.1
 

smoeschter

Explorer
Joined
Apr 11, 2013
Messages
67
Thanks to @danb35 for his really great script.
After a few years using Nextcloud I struggled in some issues since the last update of Nextcloud 27 so I decided to install it form scratch.
Due to the case that I don't have a Domain and my Router don't let me use the ports 443 (AVM FritzBox) I got some problems to make my Nextcloud reachable from the Internet but finally I solved it. So far so good.
But know another question comes up. First I recognised that MariaDB and Python use a lot of my RAM constantly, so my question is
what can be be the reason and what can I do to solve it.
Second point is If there is an Update for MariaDB what I have to do to install an upgrade for MariaDB?
Thanks in advanced Guys and again a special thanks to @danb35 for his great work.
Oh and it works with Nextcloud 27 like a charm by the way.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
First I recognised that MariaDB and Python use a lot of my RAM constantly, so my question is what can be be the reason and what can I do to solve it.
Nothing in Nextcloud uses Python; Python isn't even installed by my script, so any memory usage by that would be due to something else, likely the TrueNAS middleware. But it certainly does use mariadb extensively, and I'd expect the reason mariadb uses as much RAM as it does is that it needs that much RAM. You could try searching the web for ways to reduce its memory consumption.
Second point is If there is an Update for MariaDB what I have to do to install an upgrade for MariaDB?
If there's an update within the same series (10.6 currently), upgrading that would be a simple matter of pkg upgrade inside the jail. To upgrade to a new series (e.g., 10.7), you'd need to remove 10.6 and install 10.7. This may require other changes in the jail, as new versions may change file locations.
 

Aephir

Dabbler
Joined
Apr 25, 2021
Messages
47
Hi, I just did a re-install following this procedure, and I'm stuck with an "Internal Server Error message" when navigating to NC url. I think it might be database related. I can't seem to log in. When I try either as root or an Nextcloud, I get this error:

Code:
ERROR 2002 (HY000): Can't connect to local server through socket '/var/run/mysql/mysql.sock' (2)


I'm assuming this is /var/run/mysql/mysql.sock from inside the jail, but there is no /var/run/mysql/ directory there? I did see both "Database is compatible, continuing...", and "You did a reinstall, please use your old database and account credentials"

but also:

Code:
+ iocage exec nextcloud su -m www -c 'php -f /usr/local/www/nextcloud/cron.php'
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/local/www/nextcloud/lib/private/DB/Connection.php:140
Stack trace:
#0 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1531): OC\DB\Connection->connect()
#1 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1029): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /usr/local/www/nextcloud/lib/private/DB/Connection.php(262): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#3 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#4 /usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /usr/local/www/nextcloud/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /usr/local/www/nextcloud/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#7 /usr/local/www/nextcloud/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#8 /usr/local/www/nextcloud/lib/private/legacy/OC_App.php(803): OC\AppConfig->getValues(false, 'installed_versi...')
#9 /usr/local/www/nextcloud/lib/private/Server.php(733): OC_App::getAppVersions()
#10 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}(Object(OC\Server))
#11 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#12 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet('OC\\Memcache\\Fac...')
#13 /usr/local/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query('OC\\Memcache\\Fac...', true)
#14 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query('OC\\Memcache\\Fac...')
#15 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(193): OC\AppFramework\Utility\SimpleContainer->get('OC\\Memcache\\Fac...')
#16 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#17 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#18 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet('OCP\\ICacheFacto...')
#19 /usr/local/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query('OCP\\ICacheFacto...', true)
#20 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query('OCP\\ICacheFacto...')
#21 /usr/local/www/nextcloud/lib/private/Server.php(1115): OC\AppFramework\Utility\SimpleContainer->get('OCP\\ICacheFacto...')
#22 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}(Object(OC\Server))
#23 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#24 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet('OCP\\Lock\\ILocki...')
#25 /usr/local/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query('OCP\\Lock\\ILocki...', true)
#26 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query('OCP\\Lock\\ILocki...')
#27 /usr/local/www/nextcloud/lib/private/Server.php(2067): OC\AppFramework\Utility\SimpleContainer->get('OCP\\Lock\\ILocki...')
#28 /usr/local/www/nextcloud/lib/private/Files/View.php(106): OC\Server->getLockingProvider()
#29 /usr/local/www/nextcloud/lib/private/Server.php(467): OC\Files\View->__construct()
#30 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}(Object(OC\Server))
#31 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#32 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet('OC\\Files\\Node\\H...')
#33 /usr/local/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query('OC\\Files\\Node\\H...', true)
#34 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query('OC\\Files\\Node\\H...')
#35 /usr/local/www/nextcloud/lib/private/Server.php(1469): OC\AppFramework\Utility\SimpleContainer->get('OC\\Files\\Node\\H...')
#36 /usr/local/www/nextcloud/lib/base.php(638): OC\Server->boot()
#37 /usr/local/www/nextcloud/lib/base.php(1180): OC::init()
#38 /usr/local/www/nextcloud/cron.php(43): require_once('/usr/local/www/...')
#39 {main}


in the logs after install.

In the nextcloud-config file I have the same as a few years ago when I last installed (copied the content of the file)

Code:
JAIL_IP="10.0.30.67"
DEFAULT_GW_IP="10.0.30.1"
HOST_NAME="REDACTED_FQDN"
INTERFACE="lagg1"
JAIL_INTERFACES="lagg1:bridge0"
VNET="off"
POOL_PATH="/mnt/pool_0"
JAIL_NAME="nextcloud"
TIME_ZONE="Europe/Copenhagen"
DATABASE="mariadb"
DB_PATH="/mnt/pool_0/nextcloud/db/mariadb"
FILES_PATH="/mnt/pool_0/nextcloud/files"
CONFIG_PATH="/mnt/pool_0/nextcloud/config"
THEMES_PATH="/mnt/pool_0/nextcloud/themes"
NO_CERT=1
CONFIG_NAME="nextcloud-config"
COUNTRY_CODE="DK"


where "/mnt/pool_0/nextcloud/db/mariadb" is of course where the old database was located.

[EDIT]: Is this related to a new mariadb version??
[EDIT#2]: I did upgrade TrueNAS from FreeBSD 12 to 13 before running the script again, since the documentation stated that "This script will work with TrueNAS CORE 13.0"
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
Post in thread 'Upgrading / Replacing Nextcloud Jail to newer version using Script - Internal Server Error'
https://www.truenas.com/community/t...ript-internal-server-error.110404/post-763291
Read this post and the 2 posts after it.

I also had this issue.

When doing a reinstall, your existing config file will not be edited. You will have to manually change the value mentioned in the post I linked to in your Nextcloud config file.
 

bnorman93

Dabbler
Joined
May 3, 2022
Messages
17
I have sucessfully destroyed my install of nextcloud and when trying to reinstall i am seeing a window i have never seen before and what i keep being told is to use my old mariadb password and database location which i have no idea where it is....


MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc/mysql or /usr/local/etc. Sample
configuration files are provided in /usr/local/etc/mysql
and /usr/local/etc/mysql/conf.d.
The rc(8) script no longer uses /var/db/mysql/my.cnf for configuration
nor /var/db/mysql for logs and PID-file.
Ive tried everything i know to try and create this wndow
I got this when trying to use port 9000
Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2006] MySQL server has gone away
 

Attachments

  • nc.jpg
    nc.jpg
    91.6 KB · Views: 55
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973

Try reading this.

Make sure to read it all. There are two steps to it.
1. Deleting the my.cnf file
2. Changing the value of 'db' in your config.php

Then you can reinstall.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Top