Matthew Wieting's picture

I am running owncloud as a VM on my Esxi Host.  I got it working just fine but I now started up an Exchange server and I wanna use port 80 and 443 for my exchange server.  To my understanding I have to do something wtih my DNS but im not 100% sure on what specficilly to do.  So here is what I am working with currently...

Owncloud:

Using ports 80 and 443

Accessaible via my Dynamic dns service. 

Access url: Cloud.mydomain.com

Internal ip of owncloud: 172.16.10.60

 

Exchange mail.mydomain.com/owa

 

Essentially i wanna access owncloud on a different port (say port 8082) and to access my exchange mail I wanna use 443/80

Forum: 
Jeremy Davis's picture

If you have a firewall or a NAT router then the easiest way is to leave your server as is and route the traffic from another port(s) to the desired port(s).

E.g. in a NAT router configure port forwarding to forward (external) port 8443 to 172.16.10.60 port 443. There are so much different software/firmware about that you will need to consult the documentation of your device to find explicitly how to configure it. It can be called different things such as "port forwarding", "NAT forwarding", "virtual servers", etc...

Then externally you would get to the HTTPS interface of your ownCloud appliance with https://cloud.mydomain.com:8443

If you wish to use your ownCloud appliance on the local network it will still work as https://172.16.10.60

IIRC you will need to add this info within the ownCloud interface for this to work too...

It is also possible to change the port that your appliance uses if you'd rather. You'll need to change the listening port in /etc/apache2/ports.conf and the ownCloud site /etc/apache2/sites-available/owncloud.conf

Dela Vandaag's picture

I need to change port 443 of OwnCloud (Apache2) to another port. As I have hardly any experience or knowledge of Linux, OwnCloud or Apache2, I would very much appreciate if someone could provide me with a step-by-step explanation on how to achieve this for the versions I have installed.

This is my setup:

- ESXI 6 host machine with 3 VM's: (1) Windows Server 2012 R2 (my domain controller), (2) MS Exchange 2013 and (3) Ubuntu 16.04 with OnCloud 9 (pre-installed version from http://www.techandme.se)
- Fortigate firewall, with external port 50000 forwarding/remapping to port 443 to Ubuntu/OwnCloud server IP
- one public IP.

With this setup everything works fine as such, but the problem I am facing is that from within the lan OwnCloud requires another address (owncloud.mydomain.tld - I set the dns in my domain controller) than from the outside (owncloud.mydomain.tld:50000). As port 443 is used by Exchange 2013, I wish to change the SSL port used for OwnCloud, from within the lan as well as outside the lan to 50000. My users (kids and wife) will mainly use OwnCloud on mobile devices that move from inside to outside the lan and vice versa constantly. It will be too much for them - I expect - to constantly change the address (or port number) in their devices.

I have pretty much read every FAQ and thread on this subject, but I cannot get it to work. I have amended /etc/apache2/sites-available/000-default.conf (first line: <Virtualhost *:50000> and /etc/apache2/ports.conf (added: Listen 50000, with and without also amending the port number 443 to 50000 in the other 2 'Listen'-statements), and each time restarted Apache2. To no avail. I have also tried directions that apply to earlier versions of Ubuntu/OwnCloud, but those didn't work either. I have also visited apachelounge.com, but due to my lack of knowledge of apache and Ubuntu it was not much of a help.

I must be missing something somewhere. Oh, and the firewall in Ubuntu is inactive (says: sudo ufw status verbose), so I don't think that will be causing any problem.

Before having amended the above mentioned .conf files, sudo netstat -ntulp returns the following:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 1253/perl
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1006/sshd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1015/mysqld
tcp6 0 0 :::80 :::* LISTEN 3480/apache2
tcp6 0 0 :::22 :::* LISTEN 1006/sshd
tcp6 0 0 :::443 :::* LISTEN 3480/apache2
udp 0 0 0.0.0.0:10000 0.0.0.0:* 1253/perl

After having processed the amendments, it shows as follows:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 1253/perl
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1006/sshd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1015/mysqld
tcp6 0 0 :::80 :::* LISTEN 5349/apache2
tcp6 0 0 :::22 :::* LISTEN 1006/sshd
tcp6 0 0 :::443 :::* LISTEN 5349/apache2
tcp6 0 0 :::50000 :::* LISTEN 5349/apache2
udp 0 0 0.0.0.0:10000 0.0.0.0:* 1253/perl

It shows port 50000, but it doesn't connect on that port. Any help will be very much appreciated.

Cheers, Dela

Jeremy Davis's picture

According to your post, it certainly seems like it's working... Have you tried clearing your cookies and cache etc? Also what does it do when you try to connect using the port? You'll need to use https://owncloud.mydomain.tld:50000/

Depending on the response you get in your web browser should lead you towards what the actual issue is. E.g. if it redirects to port 443 (i.e. in the address bar it changes to https://owncloud.mydomain.tld/) then there is something else redirecting your traffic somewhere (perhaps Apache, perhaps ownCloud). If it getting a "connection refused) then there is some other config issue going on (probably Apache) but perhaps ownCloud). If it's just not finding the server at all (ERR_ADDRESS_UNREACHABLE) then it's probably most likely a DNS issue.

PS this is the forums of TurnKey Linux. We are not Ubuntu based (we're Debian based). They are quite similar but not identical. The Ubuntu forums might be a better bet?

Dela Vandaag's picture

Thanks Jeremy, for paying attention to my issue! It appeared to be something else. And sorry for my misunderstanding in posting my issue on this website. It's my lack of experience and knowledge of Linux ...

Anyhow, if someone struggles with the same issue, I will briefly describe how I solved the issue.

Next to amending /etc/apache2/sites-available/000-default.conf and /etc/apache2/ports.conf as described in my previous post, I did the following to get it to work:

- in /etc/apache2/sites-available/000-default.conf, change "<Virtualhost *:50000>" to <Virtualhost *.*>

- in /etc/apache2/ports.conf, "change Listen 50000" to "Listen *:50000 https"

- in /etc/apache2/sites-available/owncloud-ssl-domain.conf , amend the first line/statement to "<VirtualHost *:50000>

I further opened port 50000 on the Ubunto box (sudo ufw allow 50000), but as the status of my firewall was - and still is - inactive, I am uncertain whether this is necessary.

After this it worked. It kept working after reamending /etc/apache2/sites-available/000-default.conf to its original state (i.e. "<Virtualhost *:80>"). I can now reach owncloud.mydomain.tld:50000 both via my lan and outside of the lan (and without certificate errors).

Cheers, Dela

Add new comment