How to append domain to Website hosted on NAS326

Options
JakobNas326
JakobNas326 Posts: 5
Friend Collector First Comment
edited July 2023 in Personal Cloud Storage

Hi,

im kind of new to this thopic (as you might already think)…so I got a simple question:

How do I append a domain to my webpublished Website on NAS326?
Now I am hosting my Website through Webpublishing. Since I also own a domain, I would like to use it for my Website.

With visible domain forwarding, the Website works fine. But I mean thats not the point of owning a domain.
With invisible forwarding the Website is not shown correctly.

Is there a way to host a Website from NAS326 with a domain instead of http://xx.xxx.xxx.xxx:5000/MyWeb/Website?

Do I need to install additional apps via App-Center/software via ssh to properly host my Website under my domain? Any tips?

Thanks in advance :)
Jakob

Best Answers

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Options

    as I cant map ports.

    Your router could do that. Many routers can do port translation in their portforwarding menu. In that case you can forward PublicIP:80 to NasIP:5000

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Options

    I'm sorry, as long as the webserver redirects to an ip address, it will always show up in your url. The redirection to a port can be captured by forwarding both publicip:80 and publicip:5000 to nasip:5000.

    If you want more you'll have to edit the apache configuration file. The files involved for the packages are located in /etc/pkg_service_conf, and are volatile. Some files are generated on boot, or edited.

    If you edit them, you'll have to restart apache:

    /etc/init.d/pkghttpd.sh restart 
    

    If you have figured out how to change the redirections to your needs, I think I can help you with a script to inject that at boot.

    About 'publicIP:port/folderName', I guess this is about webdav. This is running in a separate server, with config in /etc/service_conf/http_dav.conf and startscript /etc/init.d/davhttpd.sh. As it's a separate server, it has to have it's own port, unless you put a reverse proxy in between.

    If it's only for own usage, it might be easier to use the build in SOCKS server in the ssh daemon. If you forward some high port on your public IP to port 22 of the NAS, and enable the ssh server, you can login from outside:

    ssh -p <high_port> -D8080 admin@public_ip
    

    then you have a SOCKS server on your remote device. In your browser in network settings enable the SOCKS server on localhost:8080, and the browser will browse via your NAS. And so you can reach to all webpages on the NAS itself.

    This is also much safer, as you only expose your ssh server. You could do that on port 22, but that attracks bots, which will try to login. If you use strong passwords that will fail, but why take the risk?

All Replies

  • suisei
    suisei Posts: 78  Ally Member
    10 Comments Friend Collector First Answer
    Options

    This setup seems insecure.😅 Do you have a router or firewall protecting your NAS? It's not danger to expose your NAS to the internet directly. If you have a router or firewall in place, consider using NAT or port forwarding to access your NAS securely…..

  • JakobNas326
    JakobNas326 Posts: 5
    Friend Collector First Comment
    edited July 2023
    Options

    Yup the websites is published through the router xx.xxx.xxx.xxx through port 5000 (http) or 5001 (https) through port-forwarding

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Options

    What exactly do you want? It's (relatively) easy to use http://yourdomain.tld/MyWeb/Website. Just let the domain point to your public IP, and let the router do port translation.

    If you don't have a fixed IP, you could set a CNAME to point to a dyndns address, and let the update automatically.

  • JakobNas326
    Options

    Thanks for your answer.

    As I understand, what you suggest is forwarding the domain. But the problem is, that if I forward mydomain.tld to myPublicIp:Port the website is shown incorrectly (on invisible forwarding) or the public ip is still shown in the url bar (visible forwarding). Do you know what I mean?

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Options

    if I forward mydomain.tld to myPublicIp:Port

    You can't. A domain is translated to one or more IP adresses (or to another domain using a CNAME), but you can't specify a port. So the browser will access the IP on port 80 for http, and the router on that IP has to do the port translation.

    Do you know what I mean?

    Not really. Are you saying the the server, when accessed on a domain, does a redirect to an IP address?

  • JakobNas326
    Options

    thanks!

    What I meant was forwarding through CNAME, which leads to incorrect visibility (iFrame) or not having the domain visible in the url-bar but instead the actual location of index.html etc (=http://publicIP:port/Myweb/Website).

    Now as you already mentioned, one cant map a domain to ip:port.

    That seems to be the problem (I guess).

    If I just redirect the domain to the IP, it will just open the zyxel-nas326 login page but not my Webpublish.

    I guess thats because I publish my Website via Webpublish (=port 5000/5001) and the domain wont lead to my website as I cant map ports.

    Hope its clearer now

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Options

    as I cant map ports.

    Your router could do that. Many routers can do port translation in their portforwarding menu. In that case you can forward PublicIP:80 to NasIP:5000

  • JakobNas326
    Options

    Thanks a lot for that comment. Didnt mean to mark it as solution tho (yet)😅

    This works, yes. But the problem still exists then. The shared adress of Web-published NAS-folders is publicIP:port/folderName and I don't think one can change this.

    Therefore I cant forward to the folder. Just to the port.

    Do you know if there is a way to forward further?

  • Mijzelf
    Mijzelf Posts: 2,645  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Options

    I'm sorry, as long as the webserver redirects to an ip address, it will always show up in your url. The redirection to a port can be captured by forwarding both publicip:80 and publicip:5000 to nasip:5000.

    If you want more you'll have to edit the apache configuration file. The files involved for the packages are located in /etc/pkg_service_conf, and are volatile. Some files are generated on boot, or edited.

    If you edit them, you'll have to restart apache:

    /etc/init.d/pkghttpd.sh restart 
    

    If you have figured out how to change the redirections to your needs, I think I can help you with a script to inject that at boot.

    About 'publicIP:port/folderName', I guess this is about webdav. This is running in a separate server, with config in /etc/service_conf/http_dav.conf and startscript /etc/init.d/davhttpd.sh. As it's a separate server, it has to have it's own port, unless you put a reverse proxy in between.

    If it's only for own usage, it might be easier to use the build in SOCKS server in the ssh daemon. If you forward some high port on your public IP to port 22 of the NAS, and enable the ssh server, you can login from outside:

    ssh -p <high_port> -D8080 admin@public_ip
    

    then you have a SOCKS server on your remote device. In your browser in network settings enable the SOCKS server on localhost:8080, and the browser will browse via your NAS. And so you can reach to all webpages on the NAS itself.

    This is also much safer, as you only expose your ssh server. You could do that on port 22, but that attracks bots, which will try to login. If you use strong passwords that will fail, but why take the risk?

Consumer Product Help Center