Can't upload files from outside local LAN

Can’t access my Nextcloud files from outside my local network.

Hi, I’m a complete noob with Linux stuff, but I managed to get Nextcloud working well on a laptop with Ubuntu 18.04 LTS.
It seems to work fine on my local LAN (access & upload- tested with 15gb of files).
The issue starts when I want to upload from my Oneplus android device on a 4G cellular network- I can’t access files nor upload. The files I’m testing are very small (screenshots from my phone) and the upload/downloading gets stuck on 0% (An error occurred while waiting for the server. Could not complete operation- the error message).
If I start the session with 4G and then turn on Wi-Fi it works smoothly and fast(!).
Tried a different Wi-Fi frequency network (5ghz instead of 2.4)- still worked.
I am really clueless why this is happening…

Nextcloud version 13.0.1
Operating system version Ubuntu 18.04/Android 8.1.4- oxygen 5.1.4
Apache version Apache 2.4.29
PHP version 7.2

Tried to forward ports on my Linksys WRT 32X router (80,443) and it changed nothing.

Please advise & help- there is no point in having a private cloud if you can’t access it from anywhere.
This is just a test project before I setup Nextcloud on raspberry pi 3 B+.
Any suggestions on how to do this in a simpler way with Raspbian stretch (I want an ordinary OS on the pi because I’m planning to use it as a media center as well with Kodi).

When you say port forward 80 and 443, did you setup NC on http on port 80? And also, are you sure about the port forwarding to the correct host?
Do you use dynamic DNS service on your router?
What happens if you try to access the server from a web browser on your phone from outside the LAN? Does it time out, or does Nextcloud give you a message stating you need to add x.x.x.x as a trusted Domain?

Big thanks for the reply.
Browser on phone with 4G doesn’t work as well (only on Wi-Fi).
I did the self-authentication with SSL, it shows me https with a red warning sign.
I did the port forwarding after installation of Nextcloud. Logged to my routers IP and changed it with the GUI of the router (I don’t have a lot of experience with Terminal/command line).
Can you advise what should I do next?

Could you please give more info regarding the other questions?

Basically, what happens is the following. Your ISP issues you with a single IP, which changes all the time, unless you signed up for a service that provides you with a single, non-changing IP. This normally costs extra, so very few home users opts for this. So, in order for your phone to know where your nextcloud instance is, it will need either an IP, or a DNS name. So you have the option to register for a Dynamic DNS name from providers like No-IP which you then input in your router. This gives you the option to always connect to your home with a DNS name, and not by IP. So this is the first thing you will need to look at.

Second, I am going to try and explain how the process works from 4G to your internal WiFi. If you are familiar with this, I apologize, but from a networking perspective it seems to me that this is where your problem currently is.
4G -----------> Connects to ‘outside’ IP/DNS name of your home router ---------> Nextcloud instance in your house. So let us say Nextcloud in your house runs on the server with IP 10.0.0.5/24, this means that your inside LAN/WiFi is on network 10.0.0.0/24. So in order to find your server from the outside, you will need to forward port 80/443 (depending on what you configured your Nextcloud server and clients as) to 10.0.0.5:80 or 10.0.0.5:443.
The reason the WiFi works is because it lives inside your LAN/WiFi. But 4G is outside.

TL;DR - World (4G) does not know where your Nextcloud server is, because it lives inside your router/LAN/firewall/domain. You need to tell the world where it is.

Does this make any sense?

I get the feeling you may be trying to access Nextcloud both outside and inside via the same IP, right?

If so, that won’t work.

Visit your public IP over 4G. If you have indeed opened ports correctly then it should show you Nextcloud.

If you want to validate you’ve opened the ports, go here and test your public IP: https://www.yougetsignal.com/tools/open-ports/ (it’ll even show you the public IP you connect from if you do it on WiFi)

Hi JasonBayton, thanks for the answer!
Yes, indeed I am trying to access Nextcloud with the same IP over Wi-Fi and 4G- the private & static IP.
So in order to resolve this, what & how should I do?
I’ve already registered Nextcloud’s private IP in the mobile app. How to make Nextcloud’s work (both server & client) with just the public IP.
Is the public IP changing all the time, because my private IP isn’t changing at all. How do I find out the router’s IP.
If I understand you correctly, whenever I try to access Nextcloud from outside the LAN, I’ll need to redirect first to my router (with its public IP) and then to Nextcloud machine (the PC/SBC that run Nextcloud).
I followed all the guides (official and unofficial)- none of them mentioned anything about how to setup DNS/remote access from the internet.
Please advise- I would like access from outside my LAN (with some security of course- but that’s the next issue to resolve).
Thanks for the help!

@Wasted101 did you perhaps read my answer at all or not?

Hi @Starfish,
Of course I did- how do I find out what is my router’s IP (public & private).
I saved a static IP for Nextcloud’s PC (private IP)- does the public IP needs to be static as well?
How do configure this mess:

  1. Laptop with Nextcloud is running Ubuntu 18.04- has a private static ip. I also reserved that IP in the router’s settings.
  2. I went into my router’s setting and changed port forwarding to 80 & 443- both on TCP protocol, this after Nextcloud’s setup.
  3. Can you guide/refer me to the relevant page- how am I supposed to set up Nextcloud on Raspberry Pi 3 B+ so I could have secure access both on Wi-Fi and from outside the network. I read about dietpi or Nextcloud pi, the easier the better.
  4. If you could show me how to install on Raspbian Stretch OS- that would be the best for me.

I know this is a tedious post- but I’m digging the internet for 3 days now and no conclusive answer.
Thanks a lot for all your help!

Unfortunately I do not have time at the current moment, but if you give me 24 hours I should be able to write up specifics for you.

Yes it likely will change now and then. You’ll need a dynamic DNS service like duck.sh, dyndns or otherwise

This is correct

Unfortunately that’s one of those assumed capabilities if you’re looking to host your own stuff. It’s different per router though there are basic guides, here’s a high-level overview, but you can likely find something in-depth when you Google [your router model] + port forwarding

https://www.pcworld.com/article/244314/how_to_forward_ports_on_your_router.html

I’d recommend nextcloud plus (NCP) :package: Appliances (Docker, Snappy, VM, NCP, AIO) - plenty of topics in there to get you going, or visit :bookmark_tabs: How to for FAQs/guides on installing/

In anycase, for all devices you connect from, you’d need to input the external URL/host/IP to connect reliably. You should not be using the internal IP for any device that’ll fall off your network.