Page 1 of 1

Cloud address takes me to site no NAS

Posted: Mon Jan 06, 2020 6:58 am
by ozstar
HI,

I have a TS231P and all has been good until now.

When I enter my cloud address from outside my LAN I don't get the NAS, I get a website I have been trying to set up on an Apache webserver on a Linux box that is on my Win 10 LAN.

It is all on my same static IP and I have been setting up host files on the Linux box.

Obviously I need to either make some change in my NAS or somewhere in the webserver.

Any suggestions please?

Thanks

oz

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 06, 2020 7:03 am
by OneCD
Modify the port-forward (usually 80) in your router to point to the NAS IP instead of your Apache server IP. ;)

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 06, 2020 7:07 am
by ozstar
Many thanks.

When I do this, can I still access the websites on the server from outside the LAN or will this always direct me to the NAS ?

oz

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 06, 2020 7:12 am
by OneCD
If your external request is always to the same external port at your public IP, your router will always forward to the same private IP.

So, you can either use a different external port for your Apache requests, or else investigate using virtual hosts on your Apache server, with one entry for the NAS.

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 06, 2020 7:33 am
by ozstar
Thanks again.

Yes I think the later will be the best. I am setting up virtual hosts on 80 for each of the sites, but of course didn't think to add the NAS.

I will have to see how I add the NAS to the host/ conf files.

oz

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 12:37 pm
by ozstar
Hi back again.. a little more confused.. :-)

To re summerise

I have a QNAP NAS TS231P which we access through.. myname.myqnapcloud.com when out of the office away from the LAN.

When I enter that address from outside the LAN we would normally get the NAS okay, but since I have setup the Linux webserver, it resolves at the apache default page page not the NAS.

It is using the same static IP as the webserver and I was sure I had to set up a .conf file for it however I am unsure how to do this.

I have tried to setup a .conf file in sites-available with this inside as I was unsure what else to do.

ServerName myname.myqnapcloud.com.conf
DocumentRoot 192.168.20.13 (which is its LAN IP)

I did the a2ensite and systemctl commands but it still resolves at the apache page. Obviously not redirected to the NAS

IN the Router I had the QNAP 443 and I have now added 80 to it, which is the webserver port also.

Are there any suggestions how I can get access to the NAS not the apache default page please?

Thanks

BTW I will not the Android App still get to the NAS even since I did the webserver, but I see they use the 443 port.

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 1:03 pm
by OneCD
ozstar wrote: Mon Jan 13, 2020 12:37 pm Are there any suggestions how I can get access to the NAS not the apache default page please?
I generally try to stay out of other people's web-server configs. :DD

Did you create a new virtual host entry for the NAS on your Apache server? It should direct name-based requests for myname.myqnapcloud.com toward the NAS instead of processing them on the web-server.

https://httpd.apache.org/docs/2.4/vhost ... based.html

https://httpd.apache.org/docs/2.4/vhosts/details.html

Maybe some of the hard-core web-server admins can advise on this?

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 1:24 pm
by ozstar
Many thanks OneCD. They are great links.

I am trying to read more into the links than what I already have, but just can't see in there what I need for this problem. Although someone who knows could take me straight to it I guess.

Yes I have added the IP and URL to the 'hosts' file, like this
xxx.xxx.xxx.xxx myname.myqnapcloud.com
Its the same static IP # as the webserver.

Also created a
myname.myqnapcloud.com.conf
'.conf' file in the sites-available folder with this content..
ServerName myname.myqnapcloud.com
but wasn't sure what to put for DocumentRoot . I tried the NAS LAN IP 192.168.20.13 but that didn't work so not sure.

This is the normal entry in the .conf file. For the other normal sites it is <VirtualHost *:80> but maybe it should be 443 ?
ServerName www.example.com
ServerAlias example.com
DocumentRoot "/www/domain"
I have also asked on the Qnap forum but so far no answers.

Thank you again

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 1:38 pm
by OneCD
I think this post has the basic syntax you'll need: https://stackoverflow.com/a/49271504/6182835
ozstar wrote: Mon Jan 13, 2020 1:24 pm Yes I have added the IP and URL to the 'hosts' file, like this
No need to edit the server 'hosts' file. You make these changes in your server's Apache configuration file.
ozstar wrote: Mon Jan 13, 2020 1:24 pm I have also asked on the Qnap forum but so far no answers.
I thought this was the QNAP forum? :wink:

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 2:18 pm
by ozstar
Doh..

Of course it is the Qnap forum ! My head is spinning trying to settle this as I will need to access the NAS in 2 days when away.

I actually meant the Apache and Linux forums trying to cover all bases as it is maybe not too common.

I not quite up to speed understanding Linux and Apache for the bells to ring with that link post, unfortunately.

I tried this but no good.
<VirtualHost *:80>
ServerName myname.myqnapcloud.com
ServerAlias myname.myqnapcloud.com

DocumentRoot //server2:443 Not sure thispart

<Directory //server2:443>
Options -Indexes
AllowOverride All
<IfModule mod_auth_core.c>
Require all granted
</IfModule>
</Directory>
... and activate the host:
a2ensite myname.myqnapcloud.com.conf

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 2:22 pm
by OneCD
ozstar wrote: Mon Jan 13, 2020 2:18 pm I actually meant the Apache and Linux forums trying to cover all bases as it is maybe not too common.
That's where you're more likely to get a useful response as this problem isn't specific to QNAP - it's more an advanced Apache configuration thingy.

Did you try the proxy redirect as shown in that post?

Sorry, I'm unable to advise further. It's something I know can be done, but have not done it myself.

Maybe someone else can help?

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 2:28 pm
by ozstar
You've been great OneCD.

I really do appreciate your help.

As you know it's a lonely place when trying something really challenging by yourself with limited knowledge of the subject.

I am just about to try the other proxy one to see what happens.

If it is a clanger, hopefully the other forums can help me.

Thanks.. Will let you know what happens..

Re: Cloud address takes me to site no NAS

Posted: Mon Jan 13, 2020 3:00 pm
by ozstar
Well gave that a try and still no joy..
ServerName StarliteNAS.myqnapcloud.com
ProxyPass /app http://server2:80/app (Also tried 443 as that is in Pt Fwd for NAS)
ProxyPassReverse /app http://server2:80/app (Also tried 443)
Did these ..
a2ensite StarliteNAS.myqnapcloud.com

and

a2enmod proxy
a2enmod proxy_http
I still land on the Apache default page for the static IP, not redirected to the NAS

Re: Cloud address takes me to site no NAS

Posted: Tue Jan 14, 2020 12:13 pm
by ozstar
Well I don't believe how simple this was.

I have been trying to get there just with http:// however as it is enabled as SSL in Pt Forwarding, once I did https:// I got to the NAS login.

Hooray ! :-)

Now what do I need to do to stop prying eyes trying to get in?

Re: Cloud address takes me to site no NAS

Posted: Tue Jan 14, 2020 12:15 pm
by OneCD
Good work, and just in-time. ;)