Problem with DDNS and NextCloud. HELP

diegorisas

Cadet
Joined
Jan 27, 2022
Messages
4
I'm trying to build a cloud storage with NextCloud for personal use only, It's pretty easy to do it local, since you really don't have to change anything and it works fine, but my goal is to be able to access to my cloud whenever I want from wherever I want, I have been searching the net and there are a few options to do so.

I'm a newbie to servers and specially to truenas but I'm currently a IT student so it shouldn't be a problem with configs files and coding.

Anyways, I'm trying to access to my cloud from anywhere using DDNS with a subdomain in freedns.afraid.org.
I tried setting up port fowarding to the NAS ip and it works fine, the truenas gui appears and I can log in just fine, but I'm stuck here, I can't make it work with NextCloud.

I really don't know how to proceed, I dont know if I should use the default service provided by truenas to get up the DDNS or if I should just make a cron, i tried both ways and I didn't suceed , if anyone could point me to a step by step detailed guide or just help me over discord because its starting to be frustrating.

The closest that I've been to figuring it all out it just redirected me to a SLL error (which dont make any sense since I didnt even make it that far).

P.S: I guess the ultimate phase of the project would be to set up a VPN in the truenas server and make ir all work with that, but first I want to learn with DDNS and port forwarding cuz it seems like the best first step (knowing the dangers of opening ports and stuff, dont worry).
 

diegorisas

Cadet
Joined
Jan 27, 2022
Messages
4
I forgot to tell that (I guess it's kind of obvious) everything that cost money per month is off the table, the whole point of my project was to be able to use a cloud without paying a fee every month.

Just because I can't afford it, i'm a student.
 

diegorisas

Cadet
Joined
Jan 27, 2022
Messages
4
Okey, so I got to this stage:

-I purchased a Domain in ovh (so cheap btw)
-I created a jail to install nginx and certbot there

I got my certs done and also i can perfectly connect to nginx index.html from my domain, (both with http and https).

However, I'm lost at this point, i tried to proxy_pass to the ip that my TrueNas is running in nextcloud , which is the same but with the port :8282 at the end, and when i access to my domain it redirects me to the IP 192.168.X.X:8282 so basically it works locally, but of course it doesn't work outside my home network.

So how am I supossed to go on I don't know how else I can proceed nor I find any other examples of the nginx.conf file that works for me.

Here's the tutorial I followed (great by the way, I like this guy) : https://www.youtube.com/watch?v=fTruxKi9qbs
(I practically completed the tutorial is just the last part that doesn't work for me, when he redirects using the proxy and reload it works for him but not for me)


Here's my actual nginx.conf file:


#user nobody;
worker_processes 1;

# This default error log path is compiled-in to make sure configuration parsing
# errors are logged somewhere, especially during unattended boot when stderr
# isn't normally logged anywhere. This path will be touched on every nginx
# start regardless of error log location configured here. See
# https://trac.nginx.org/nginx/ticket/147 for more info.
#
#error_log /var/log/nginx/error.log;
#

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
listen 443;
server_name localhost;

ssl_certificate cert.pem;
ssl_certificate_key cert.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
# root /usr/local/www/nginx;
# index index.html index.htm;
proxy_pass 192.168.X.X:8282;
}
(it continues but everything from here on is commented and I dont want this to be that long).
 

diegorisas

Cadet
Joined
Jan 27, 2022
Messages
4
Ok so finally, I discarded the jail version and did a VM (ubuntu server) with docker and portainer to run nginx proxy manager gui so it would be easier, however, once everything is done and set up I end in the same problem.

When I access to my domain it redirects me to the local IP instead of the domain/login (which should be the end showing the login part of NextCloud).

I did all the docker install and that stuff following these tutorials:
-https://www.youtube.com/watch?v=hxSAGY5zRwQ&list=PLCQ7UEq6XQ1HQkX-oyAxoV7jTJfHX4OPz&index=14
-https://www.youtube.com/watch?v=11PMZZycV0U&list=PL-SkhJm0NYplNo4IoAjYjlzzZOdPH6cjI&index=3
 
Top