Help setting external access to nextcloud

Hi everyone,

I have successfully setup next cloud and am able to access it perfectly while on the same network. Although i’m in need of some help setting up access externally when i’m not on the same network. while i would say in tech savy this is beyond confusing me

Any help would be amazing

Update
so i have now port forwarded ports 80 to 443 on my router and im able to access the nextcloud login page although i cannot login as it tell me im not on a trusted domain ?

FYI im using the easy premade linux method so no GUI

UPDATE

I have now reinstalled everything again using the long liunx method with gui. Although i keep getting this error

So, you need to:

Forward port 443 from the firewall (router) to 443 on the NC server (or 80 for non-SSL setups). Forwarding 80 TO 443 sounds like you’ve opened every port from 80 to 443. If that’s not the case then great, but you only need one of those ports.

Next, it’s now telling you that the only trusted domain you’ve added during installation is likely the internal IP address. For security it doesn’t allow anyone to connect via any domain pointed at your server. It should have prompted you to add it automactically by logging in and clicking authorise, but if not, you can add it in your config/config.php file located in the root of your NC installation (/var/www/html/nextcloud/)

In there you can find and edit so the lines read like:

  'trusted_domains' =>
  array (
    0 => '192.168.1.100',
    1 => 'cloud.domain.com',
  ),

Finally it’s indicating you have a permissions issue, so you need to SSH back into your server and do a sudo chmod -R 770 /var/www/html/nextcloud/data. Really it sounds like you might need to find the permissions guide on the NC docs to ensure you’re not leaving anything else world-readable also.

Hope that helps :slight_smile:

1 Like

Hi Jason,

Firstly i want to say thank you for helping me out, in the end i ended up reinstalled for a 3rd time and i now have it work but i will be saving everything you wrote there, for troubleshooting.

Just a quick question you might know the answer of, when accessing nextcloud from another machine/ device, am i going to have to keep editing the config.php to allow each machine ?

UPDATE

so i have tested nextcloud from a different IP and a different device and it allows me to login fine without having to authorise anything. is that normal ?

also i type in just my ip address without /nextcloud i can get access to the Apache2 Ubuntu Default Page is that safe, for people to be able to to access that page just by typing in my IP.
Should i just remove the file its pointed to and that should bring up nothing correct ?

No need to auth from each machine, just for each domain you want to use to connect to it, for example if you had a home server with DNS pointing:

cloud.domain.com
update.domain.com
mysite.net
beta.clientsite.org

to the one web root, being able to get to NC when you append /nextcloud to any domain, you’d have to add all 4 domains to the config. That’s all. Similarly anyone can point their domain at your IP, however unless you’ve authorised it Jim using fraudulentdomain.de can’t pretend to be your NC cloud offering.

The default apache page offers nothing in the way of security issues. Leave it there if you have nothing to replace it with, otherwise it’ll just 404 on someone who types in the domain/IP without /nextcloud.

1 Like

you are a superstar :slight_smile:

next question haha i need to edit the config.php but the last time i tried to do this the file was locked. the only way was to edit the permissons but thats what messed up my next cloud last time.

i need to do this because i get this message “No memory cache has been configured. To enhance your performance please configure a memcache if available.” from what i have read i need to install Redis and edit the config.php

off topic when using the next cloud android app the auto upload doesn’t seem to work, im on android 7.0 using the next-cloud beta apk

also getting this error “Last cron job execution: 2 hours ago. Something seems wrong.” im able to upload and download files so im not sure if this is something to worry about or not

Use sudo, don’t change permissions of the file

Would you believe, I have a guide for that: here

There are several topics covering this already, do a search and if you can’t relate, open a new topic for it :slight_smile:[quote=“Jake_Mallon, post:5, topic:5634”]
also getting this error “Last cron job execution: 2 hours ago. Something seems wrong.”
[/quote]

Have you setup the cronjob, or just ticked the box for cron?

1 Like

ok many thanks i will take a look

i have looked at the other topics i believe i found one where u was having a similar issue although nothing on them seems to work for me.

The box was ticked on install i haven’t set it up?

Think i’m out of my knowledge zone here lol

https://docs.nextcloud.com/server/9/admin_manual/configuration_server/background_jobs_configuration.html#cron

If you’re unsure, just start a new topic.

1 Like

ok so we are getting there haha.

so i think i have setup cron correctly just waiting to see what happens in 15 minutes.

now i didnt have this issue before but now i do. i cannot access my next cloud via HTTPS if i try the page just isn’t found, but works fine using just http. i have looked at a few different guides but im still confused

If you’re using Apache, is your vhost set up correctly? Any changes since it worked?
When you say not found, is that a 404 or something else?

Have you done the steps to enable https?

the changes since it last worked is a complete reinstall lol.

i get this This site can’t provide a secure connection.192.168.0.9 sent an invalid response.

i looked at below but i dont understand where is the Apache VirtualHosts config file ?
https://docs.nextcloud.com/server/9/admin_manual/configuration_server/harden_server.html

i guess my cron isn’t working Last cron job execution: 21 minutes ago :frowning:

I’m guessing you’re on Ubuntu, which is /etc/apache2/sites-available/

Have you reinstalled apache also? If so you’ll need to re-enable the modules for SSL (as well as others) and sort out your SSL certs in the proper locations (or those you define in the vhost)

found it great but when i add

VirtualHost *:80
ServerName cloud.nextcloud.com
Redirect permanent / https://cloud.nextcloud.com/
/VirtualHost

nextcloud becomes completely unreachable.

This is stressful been doing this for two days now

ran a2enmod ssl
a2ensite default-ssl
service apache2 reload

and it say all ready enabled

if i ask support would they teamviewer in and help ?

I’m not 100% sure what you’re doing there.
If you want SSL to work you need to configure SSL on port 443, not create a *:80 vhost in the SSL file. You can redirect the non-https traffic later, when https actually works.

I think you should go through my guide step by step from step 4. Ensure you have the right packages installed, then go one step at a time through setting up SSL, pretty links, installation, etc. If you can’t follow that let me know and I may be able to edit areas to make them clearer.

Support will offer paid help, otherwise you’re stuck with us :slight_smile:

hi there,

thanks for your help, just didn’t want to bug u anymore with silly questions but as its paid support might need to pick your brain for abit.

as i though most of step 4 fly’s as it was all installed although when i get to step 5

sudo vim /etc/apache2/sites-available/nextcloud.conf

this command is not found ?

"jake@ubuntu:~$ sudo a2enmod ssl
[sudo] password for jake:
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled
jake@ubuntu:~$ sudo vim /etc/apache2/sites-available/nextcloud.conf
sudo: vim: command not found
jake@ubuntu:~$ "

sudo apt install vim – it’s just a package to edit files, so you could use whatever you were using to edit the conf file if you prefer. In fact, might be easier that way. gedit, nano, something else?

sudo a2ensite nc-redir.conf does not exsist ?

trying to use echo ‘Hello, world.’ >nc-redir.conf but i get permission denied

Yes, you’d have to create it and populate it with the information in the guide before trying to enable it.

trying to use echo ‘Hello, world.’ >nc-redir.conf but i get permission denied in /ect/apach2/sites-available even with sudo at the beginnning

ok well i think i have done something right and something wrong i am now able to access the nextcloud page with https although the https itself is red with a cross going through it.

on the admin page security and setup warnings say all checks passed

cron still says something seems wrong.