Proper installation and configuration of Nextcloud on Portainer on OMV machine with already configured nginx/duckdns

  • Hello,


    I need a simple solution how to install and configure Nextcloud on my machine to get:

    - access to the service for users from the outside of my network,

    - access to all or specified data of my hard drive with ability to get some users folder too (per user),

    - accessing via dns/proxy (from the outside of my network).


    Right now I have configured NGINX with some custom connections to my plex server, omv gui and something else. Some ports are configured for all my existing containers, some of them (ports) are also opened in my router settings.


    There are some solutions available in the net, but all of them are just to simple (installing nextcloud on the machine without any other containers) or too complex (installing nextcloud, nginx, even portainer or so).


    Please tell me what information you need from my side to prepare a proper setup/configuration :)


    Thank you in advance.

  • This is the definitive How To on the forum. I don’t know how well it will dovetail into your preexisting scenario. [How-To] Nextcloud with swag (Letsencrypt) using OMV and docker-compose

    Easy data backup: In a Scheduled Job: rsync -av --delete /srv/dev-disk-by-label-SOURCE/ /srv/dev-disk-by-label-DESTINATION/ (HT: Getting Started with OMV5)
    OMV 5 (current) - Thinkserver TS140, Nextcloud, Plex, Airsonic, Navidrome, Ubooquity, Digikam, Wetty, & Heimdall - NanoPi M4 (v.1): backups using Rsync and Rsnapshot - Odroid XU4 (Using DietPi): PiHole - hc2, xu4, Pi 3B+, Odroid H2, and VirtualBox: Testing and playing - Mac user converting to Linux, Debian 10 KDE.

  • What about the ports? All cases uses ports 80 and 443 which in my case are used for something else. I've attached a list of all my containers and assigned ports, aso with the list of forwarded ports set on my router (nextcloud entry is a remnant of a previous installation attempt which btw was successful, but only working via proxy/domain address set in nginx, not using the ip address and below port; anyway that installation was not correct so I need to remove it).



  • You have to change "volumes" variables with your paths.


    In Nginx, simply create a sub-domain that point to "http://NEXTCLOUD_IP:9323" (you can change the port; in my case is 9323).


    Voilà!

  • You just forward your ports on your router to something unused. Look at the yml file example in the linked How To, down about lines 45 & 46. But I don’t see anything in your settings - Portainer or router - that will conflict with this install.

    Easy data backup: In a Scheduled Job: rsync -av --delete /srv/dev-disk-by-label-SOURCE/ /srv/dev-disk-by-label-DESTINATION/ (HT: Getting Started with OMV5)
    OMV 5 (current) - Thinkserver TS140, Nextcloud, Plex, Airsonic, Navidrome, Ubooquity, Digikam, Wetty, & Heimdall - NanoPi M4 (v.1): backups using Rsync and Rsnapshot - Odroid XU4 (Using DietPi): PiHole - hc2, xu4, Pi 3B+, Odroid H2, and VirtualBox: Testing and playing - Mac user converting to Linux, Debian 10 KDE.

  • You have to change "volumes" variables with your paths.


    In Nginx, simply create a sub-domain that point to "http://NEXTCLOUD_IP:9323" (you can change the port; in my case is 9323).


    Voilà!

    And that is it? Great, thanks!


    What about giving access to admin user / custom users to the specific directory of my hard drive?


    In example I have directories as below (H is of course my OMV main drive):

    H:/MOVIES/

    H:/SERIES/

    H:/MUSIC/

    and H:/ to gice access to all stored directories and files.

    etc.

    Should I add these entries directly in above code or should it by available from the Nextcloud gui directly?


    And what about this variable:

    MYSQL_ROOT_PASSWORD=YOUR_PASSWORD

    is this my root password which I set in omv console / omv, or should I create a new one here? What is the difference between this and MYSQL_PASSWORD=YOUR_PASSWORD? Should these password be the same?

  • So the existing folders cannot be added? Of course there is possibility to move any data from the existing folders on the hard drive to the folder(s) connected to the nextcloud accounts (from eg. Windows Explorer via SMB connection)?

  • So the existing folders cannot be added? Of course there is possibility to move any data from the existing folders on the hard drive to the folder(s) connected to the nextcloud accounts (from eg. Windows Explorer via SMB connection)?

    Yes, like OneDrive, Google Drive, Dropbox, etc....

    But, make attention:


    If you have, for example, a .ISO file that is 4GB large, and make a copy inside a folder of a nextcloud's account, on the NAS now you have 2x 4GB files because the data of any user on Nextcloud are stored separately inside "/var/www/html/data".

  • Yes, like OneDrive, Google Drive, Dropbox, etc....

    But, make attention:


    If you have, for example, a .ISO file that is 4GB large, and make a copy inside a folder of a nextcloud's account, on the NAS now you have 2x 4GB files because the data of any user on Nextcloud are stored separately inside "/var/www/html/data".

    Okay, thank you for clarification.


    My point of installing Nextcloud is to have a safer solution than for example FTP/SFTP (or simpler than e.g. OpenVPN) to share files between me and my friends/family.


    Last technical question is: how the sharing works? I need to create separate accounts for my members by myself? And these members can share uploaded files to their private space using simple download link, or giving me an access to their space from which I should be able to download their files (to my space, or directly to the hard drive?) - just like sharing folders in Google Drive?

  • Every member of the family can have a personal account with user, pass and email (for notifications).

    The admin can set the maximun space avaiable for every account (unlimited, 1GB, 5GB, etc..).

    Every account can share one or more files/folders with other account or, with a link, with every other user.

    If you ever used OneDrive, Google Drive or similar services, Nextcloud is the same thing.

  • Every member of the family can have a personal account with user, pass and email (for notifications).

    The admin can set the maximun space avaiable for every account (unlimited, 1GB, 5GB, etc..).

    Every account can share one or more files/folders with other account or, with a link, with every other user.

    If you ever used OneDrive, Google Drive or similar services, Nextcloud is the same thing.

    Great, thank you again. I will try to install it now :)


    Edit:


    Installation succesful :) Accessing via server ip and custom port is working, but I have a problem with accessing with my custom proxy address.


    I've added proper entry in my nginx settings and when accessing the site information is displayed (from nextcloud) that this site is not on the trusted list and I need to add it to te config.php file under 'trusted_domains' section (just like in the example file config.sample.php). Unfortunately I am not able to edit this file, even when both containers are off. There is an information that file cannot be opened. I am able to open config.sample.php file.

    The same information I have received when trying to connect to my server via the Android Nextcloud app.


    So I've managed to "fix" this using this manual:

    [How-To] Nextcloud with swag (Letsencrypt) using OMV and docker-compose

    but instead of filling the 'trusted_domains' like on this manual I've set it as follows:

    Code
    'trusted_domains' =>
    array (
    0 => '192.168.50.150:4141',
    1 => 'my.proxy.address',
    ),

    and now it works from the website and the Android app, but the connection is way to slow. While logging from the Android app I am unable to pass logging window - logging data is entered and 'Log in' button pressed, but it keeps spinning and not logging at all. I have a similar situation when logging from my pc web browser but in this case simple 'F5' pass the logging screen and takes me to the Nextcloud app browser.

    Any thoughts about it?


    I also have an additional question. So the data is stored in the H:/NEXTCLOUD/data directory. I does not have an access to it via SMB - information that I do not have a privileges to access it displayed (without pointing to specific user). Should I add this directory to my shared folders under OMV settings and gave it root (users?) ACL?

  • I have zero issues w/ Nextcloud being slow, except for when it first installs.. After about 10min, it's very responsive. I've read lots of complaints about the Android app. I don't use it, I just shortcut my Nextcloud homepage to the desktop of my phone. The webUI is pretty mobile friendly and I've had zero issues with it.

    Air Conditioners are a lot like PC's... They work great until you open Windows.


  • I have zero issues w/ Nextcloud being slow, except for when it first installs.. After about 10min, it's very responsive. I've read lots of complaints about the Android app. I don't use it, I just shortcut my Nextcloud homepage to the desktop of my phone. The webUI is pretty mobile friendly and I've had zero issues with it.

    It works ok when I am reaching it via my ip and port (locally), but it slows down when using proxy address. Maybe my proxy configuration is incorrect in some way? Or the config.php need some additional modifications?


    I am literally stuck on the login screen and the only way to pass it is to refresh the page. Very strange behaviour. Uploading / downloading data works ok, but just the GUI behaviour is very very slow.

  • Hi.


    So I've messed something up with my nextcloud installation.


    First of all I was looking fot the solution to fix behaviour described above and while resolving it I messed up config.php file (I does not have an copy unfortunately).


    So I've removed all data connected with nextcloud from portainer - and for some reason nextcloud data folder and nextcloud config folder were not removed in this process. I need to remove it manually from my hard drive (via SMB) - changing permissions back to User was required to do this.


    After that I was trying to deploy nextcloud container using the same compose file, also with changed path to data/config file (e.g. Config/nxtcld instead of Config/nextcloud and NXTCLD instead of NEXTCLOUD for data). For some reason I am unable to make it to work again. Both containers (main and database) are deployed, but logs of nextcloud container shows me below information again and again:


    Quote

    Initializing nextcloud 22.1.1.2 ...,

    rsync: [generator] delete_file: rmdir(data\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240#PATH WHERE USER'S DATA ARE STORED) failed: Device or resource busy (16),

    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3],

    The paths are 100% correct.

    Restart of the machine didn't help.

    I've even changed the port to other - didn't help.


    And I hear constant work of my hard drive while this process is in progress.


    Please help :(


    Edit:


    Additional observations:

    Folders Config/nextcloud (with all data created while deploying container) and /NEXTCLOUD/data are created and are accessible, but permissions for these folders are changed - I need to restore permissions of my root folder to delete these folders.

    Previously for correct installation these folders are also created but not accessible from SMB (permissions were also updated in this case).

  • So I have finally found what was wrong with my installation...


    When first deploying I have copied code shared by Thormir84 directly to the Portainer editor, changed some stuff and deployed it. Everything works as expected. After messing around with the config.php file, before decided to remove everything and start over I have copied compose text from Portainer editor directly to the newly opened tab in Notepad ++ without saving it as file. For the second and further installations I was using compose text copied directly from the Notepad++ to the Portainer editor.


    Please see below path and error log:

    Code
    /srv/dev-disk-by-uuid-1234/NEXTCLOUD/data:/var/www/html/data #PATH WHERE USER’S DATA ARE STORED
    Code
    delete_file: rmdir(data\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240#PATH WHERE USER'S DATA ARE STORED) failed: Device or resource busy (16),
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3],

    In log file there is an data\ path with these strange numbers like #320\#240 etc., and at the ending there is a comment #PATH WHERE(...). So I've removed whole comment with whitespaces till the to have it directly like this:

    Code
    /srv/dev-disk-by-uuid-1234/NEXTCLOUD/data:/var/www/html/data

    And container was finally deployed without problems...


    So it looks like copying from the Portainer editor to Notepad++, or from the Notepad++ to the Portainer editor messed up my text file in processing white spaces and replaced it with some non-white space chars which Portainer took as the part of the path to create.


    Containers are running and nextcloud is accessible locally now. But I still have an problem with accessing it outside.


    Here is my config.php file:


    It is an original config.php file. I've just added this entry in the 'trusted_domains' variable: 1 => 'nextcloud.domainname.dnsprovider.org',. Without this entry I am unable to acces my nextcloud from the outside - information that this site is must be added to the config.php file under trusted_domains variable is displayed.


    Edit:


    Found it!


    I have found the solution here:

    https://help.nextcloud.com/t/s…c-client-on-linux/47549/4

    I have added these lines to my config.php file:

    Code
    'overwrite.cli.url' => 'https://nextcloud.domainname.dnsprovider.org',
    'overwriteprotocol' => 'https',
    'overwritehost' => 'nextcloud.domainname.dnsprovider.org',
    'trusted_proxies' =>
    array (
    0 => '1.2.3.4',
    ),

    And it is loading now.


    It is working also in both configurations:

    Code
    'trusted_domains' =>
    array (
    0 => '1.2.3.4:1234',
    1 => 'nextcloud.domainname.dnsprovider.org',
    ),

    and:

    Code
    'trusted_domains' =>
    array (
    0 => '1.2.3.4:1234',
    ),

    and also without this variable:

    Code
    'trusted_proxies' =>
    array (
    0 => '1.2.3.4',
    ),


    Not sure which configuration is 100% correct (or which entires are 100% required) but at least it is working, also on my Android phone :)

    Edited once, last by godzinilla: Found a solution of all my problems. ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!