Jump to content
Not connected, Your IP: 44.198.57.9
Sign in to follow this  
mannticleer

ANSWERED External access to nextcloud: help me correctly forward my ports!

Recommended Posts

I have the VPN set up on my router. In the past I have successfully forwarded ports, using iptables, for a torrent client and a subsonic server that's running on a raspberry pi (my subsonic account uses a subdomain on subsonic.org).

 

Now I've installed nextcloud on another raspberry. I can access it locally via the raspberry's ip, but I can't get to it externally. For external access, I'm hoping to use a subdomain on my own website.

 

Here's what I've done:

 

1. Pointed the A Record of my subdomain (cloud.mysweetsite.com) to my DHCP ip address.

2. Forwarded a port on airvpn.com, using local port 443.

3. In my router (dd-wrt), I set up this iptable:

 

iptables -I FORWARD -i tun1 -p udp -d 192.168.1.102 --dport 15119 -j ACCEPT
iptables -I FORWARD -i tun1 -p tcp -d 192.168.1.102 --dport 15119 -j ACCEPT
iptables -t nat -I PREROUTING -i tun1 -p tcp --dport 15119 -j DNAT --to-destination 192.168.1.102:443
iptables -t nat -I PREROUTING -i tun1 -p udp --dport 15119 -j DNAT --to-destination 192.168.1.102:443
 

15119 is the port I forwarded on airvpn.

 

4. in /etc/apache2/sites-available/nextcloud.conf I'm specifying ServerName cloud.mysweetsite.com

 

What am I missing? What have I done wrong? Perhaps I should ask on the nextcloud forums instead of here! But it just seems like the vpn adds an extra layer...

Share this post


Link to post

I resolved this by simply specifying a different port in the apache settings.

 

Like, I changed it from 443 to the new one in:

/etc/apache2/sites-available/default-ssl.conf

/etc/apache2/sites-available/000-default.conf

/etc/apache2/ports.conf

Share this post


Link to post

Scratch that. Actually that didn't solve it. That allowed me to access the site via the domain name while on my own network. But once I'm outside my network, I can't get to it. Not sure what to do!

 

Right now I'm using the port that I forwarded on the airvpn site. It's not using local port 443.

Share this post


Link to post

Why did you point the A record to your DHCP address instead of the VPN server exit? This is incorrect.

What does the TCP test on the port check utility say?

https://airvpn.org/ports/

 

It shows green. "Reachable on server IP over the external port..."

 

And at first I had the A Record pointed to the VPN server exit. But when doing so, the url did not resolve to the nextcloud server (however, this very well may have been due to incorrectly set up iptables). So I asked a friend, and he told me I was pointing it to the wrong address. Okay, I'll try to the VPN server exit. Thanks!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image
Sign in to follow this  

×
×
  • Create New...