Virtual host not working

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
User avatar
Timidfriendly
Getting the hang of things
Posts: 50
Joined: Sat Oct 09, 2010 11:03 pm
Location: Netherlands
Contact:

Virtual host not working

Post by Timidfriendly » Tue Sep 18, 2012 2:37 am

I get the impression the the virtual host file is not being used by the system, but can't figure out how to check this. I can access the folder using nas-ip-address/Web/myfolder, but not using the vhost values.
I tried turning the virtual host on and off in the GUI but that hasn't worked.

When I take a look at the contents of the file (/etc/config/apache/extra/httpd-vhosts-user.conf) everything looks ok. This is why I want to check that the this file is being correctly called.


Can someone tell me where i need to do I need to look and what I need to look for?

----
Using 3.7.3 build 20120801
TS-459 Pro (First iteration: Intel Atom Dual Core 1.66GHz, Memory 1GB DDRII) running QTS v4.2.5 &&
TS-453 Pro (8gb) running QTS v4.3.3

User avatar
schumaku
Guru
Posts: 43673
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Virtual host not working

Post by schumaku » Tue Sep 18, 2012 3:04 am

Using fully resolveable DNS FQHN URLs ot access the different virtaul hosts? The requesting host FQHN is the only way that can be used to distinguish between virtaul hosts.

User avatar
Timidfriendly
Getting the hang of things
Posts: 50
Joined: Sat Oct 09, 2010 11:03 pm
Location: Netherlands
Contact:

Re: Virtual host not working

Post by Timidfriendly » Fri Sep 21, 2012 2:58 am

I spent some time trying to decifer your kind response without success.

What are you asking me? and what point are you trying to clarify
TS-459 Pro (First iteration: Intel Atom Dual Core 1.66GHz, Memory 1GB DDRII) running QTS v4.2.5 &&
TS-453 Pro (8gb) running QTS v4.3.3

User avatar
pwilson
Guru
Posts: 22581
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Virtual host not working

Post by pwilson » Fri Sep 21, 2012 4:30 am

schumaku wrote:Using fully resolveable DNS FQHN URLs ot access the different virtaul hosts? The requesting host FQHN is the only way that can be used to distinguish between virtaul hosts.


Timidfriendly wrote:I spent some time trying to decifer your kind response without success.

What are you asking me? and what point are you trying to clarify


I believe schumaku is suggesting that your NAS is not recognizing your FQDN (Fully Qualified Domain Name). Did you register a "Dynamic DNS" name for your "Virtual Server" name? See: QNAP Tutorial: Set up DDNS Service for Remote Internet Access to QNAP NAS

For example if you register the name "widgetsupply.dyndns.org", then you could setup your Virtual Server, so that access to http://widgetsupply.dyndns.org is redirected to your /share/Web/widgets folder (website).

Meanwhile you could register another name "doohickys.dyndns.org", and set up a Virtual Server, so that access to http://doohickys.dyndns.org would be redirected to your /share/Web/doohickys folder (website).

If you haven't registered "widgetsupply.dyndns.org" and "doohickys.dyndns.org" with a Dynamic DNS provider, then these FQDN (Fully Qualified Domain Names) will not exist, and therefore your sites: http://widgetsupply.dyndns.org and http://doohickys.dyndns.org won't work. All your Virtual Server "names" need to point to your networks WAN IP address.

Did you follow the QNAP Tutorial: Host Multiple Websites on QNAP NAS by the Virtual Host Feature? It does mention "DNS Records", but doesn't explain that you need to register these names, either directly with a Domain Name Registrar (which costs money), or register a Dynamic DNS name for your site instead.

Please check out both of these Tutorials:

  1. Set up DDNS Service for Remote Internet Access to QNAP NAS
  2. Host Multiple Websites on QNAP NAS by the Virtual Host Feature

Hopefully my observations above with help you to figure out how to use these Tutorials together to get the results you are looking for.

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.

Lizzie
New here
Posts: 5
Joined: Mon Nov 12, 2012 12:11 pm

Re: Virtual host not working

Post by Lizzie » Tue Nov 13, 2012 8:57 am

This is the first post that provided some guidance on how to make this work (Thank you!), but I am still completely confused. I have a static IP address; will the NAS host multiple sites with one static IP address? I have not conceptually figured out how, if I park these sites in Web, in folders called "Site 1" and "Site 2" how the traffic trying to find WidgetsGalore knows how to go to "Site 1" and the traffic trying to find AmazingDoohickys knows how to go to "Site 2" . Or does it just figure it out and it's magic? I host with GoDaddy and both sites point to the same IP address; how does it figure out where to go from the moment it hits my NAS?

I just upgraded from x09 to x69 Pro and I'm delighted to say, that I made no fewer mistakes setting up this one than I did the first one.

User avatar
pwilson
Guru
Posts: 22581
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Virtual host not working

Post by pwilson » Tue Nov 13, 2012 10:40 am

Lizzie wrote:This is the first post that provided some guidance on how to make this work (Thank you!), but I am still completely confused. I have a static IP address; will the NAS host multiple sites with one static IP address? I have not conceptually figured out how, if I park these sites in Web, in folders called "Site 1" and "Site 2" how the traffic trying to find WidgetsGalore knows how to go to "Site 1" and the traffic trying to find AmazingDoohickys knows how to go to "Site 2" . Or does it just figure it out and it's magic? I host with GoDaddy and both sites point to the same IP address; how does it figure out where to go from the moment it hits my NAS?

I just upgraded from x09 to x69 Pro and I'm delighted to say, that I made no fewer mistakes setting up this one than I did the first one.


Assuming you want WidgetsGalore.dyndns.org & AmazingDoohickys.MyCloudNAS.com setup...

Create DDNS & MyCloudNAS.com accounts for your 2 virtual hosts.

  1. Follow the steps in QNAP Tutorial: Set up DDNS Service for Remote Internet Access to QNAP NAS to register: WidgetsGalore.dyndns.org
  2. Follow the steps in QNAP Tutorial: Access QNAP NAS from the Internet by MyCloudNAS Service to register: AmazingDoohickys.MyCloudNAS.com

Check that they are properly registered:

Image
To check that the domain name of the NAS is correctly mapped to its WAN IP, you may visit MxToolbox DNS Lookup Tool. Enter your domain name: WidgetsGalore.dyndns.org for DNS lookup and it will return your IP address. Repeat again for your AmazingDoohickys.MyCloudNAS.com domain name.

If the MxToolBox DNS Lookup Tool successfully returns your external IP address for both names, you can proceed to the remaining steps.


Activate the Web Server and Configure the Virtual Host Function

Follow the steps below to use virtual host.
  1. Select “Enable Virtual Host” and click “Apply”.
  2. Click “Create New Virtual Host”.
    WebUI > Network Services > Web Server > Virtual Host (tab)
    Image
    1. Enter the host name: WidgetsGalore.dyndns.org
    2. Specify the folder /Web/WidgetsGalore where the web files will be uploaded to.
    3. Specify the protocol: HTTP.
    4. Specify the port number: 80
  3. Click “Apply”.
  4. Click “Create New Virtual Host”.
    1. Enter the host name: AmazingDoohickys.MyCloudNAS.com
    2. Specify the folder /Web/AmazingDoohickys where the web files will be uploaded to.
    3. Specify the protocol: HTTP.
    4. Specify the port number: 80
  5. Click “Apply”.

This will create your 2 Virtual Hosts. Now all you have to do is use Windows Explorer, and browse to your "Web" folder on your NAS.

Upload the Website Data to the NAS

So far we have NAS configured to host multiple websites and next we are going to upload the files for each website by mapping the Web (or Qweb) share folder to your desktop.
Image

Once the 'Web' share folder is mapped create the new folder for each website.
ie Create folders called "WidgetsGalore" & "AmazingDoohickys"

  1. Access the WebDirectory using Windows Explorer
  2. Create a subdirectory called: "WidgetsGalore"
  3. Create a subdirectory called: "AmazingDoohickys"
  4. Copy your content for WidgetsGalore.dyndns.org to the WidgetsGalore subdirectory
  5. Copy your content for AmazingDoohickys.MyCloudNAS.com to the AmazingDoohickys subdirectory

Once you have completed all these steps, you can ask someone outside your network to try to connect to: http://WidgetsGalore.dyndns.org and http://AmazingDoohickys.MyCloudNAS.com. They should be successful, and should see the content you placed in each Websites "WebRoot" folder.
("WidgetsGalore" & "AmazingDoohickys" respectively).

Accessing these websites from inside your network will probably NOT work, unless your Router supports "NAT-loopback". They should however work everywhere outside your network, unless your ISP is blocking access to Port 80. (The standard HTTP port).

I hope this explanation wasn't too confusing for you. (I no longer run Microsoft Windows).

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.

Lizzie
New here
Posts: 5
Joined: Mon Nov 12, 2012 12:11 pm

Re: Virtual host not working

Post by Lizzie » Tue Nov 13, 2012 10:52 pm

I take it that the answer is one cannot use just the one IP address and each site has to have its own, in this case dynamic, address. Do I have that right?

User avatar
doktornotor
Ask me anything
Posts: 7521
Joined: Tue Apr 24, 2012 5:44 am

Re: Virtual host not working

Post by doktornotor » Tue Nov 13, 2012 10:57 pm

Lizzie wrote:Do I have that right?


No. Try again.
I'm gone from this forum till QNAP stop wasting volunteers' time. Get help from QNAP helpdesk instead.
Warning: offensive signature and materials damaging QNAP reputation follow:
QNAP's FW security issues
QNAP's hardware compatibility list madness
QNAP's new logo competition
Dear QNAP, kindly fire your clueless incompetent forum "admin" And while at it, don't forget the webmaster!

User avatar
pwilson
Guru
Posts: 22581
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Virtual host not working

Post by pwilson » Tue Nov 13, 2012 11:12 pm

Lizzie wrote:I take it that the answer is one cannot use just the one IP address and each site has to have its own, in this case dynamic, address. Do I have that right?


Such a setup would not be creating "Virtual Hosts". "Virtual Hosts" are separate Websites all running on the same IP address and port, but under different FQDN's (Fully Qualified Domain Names).

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.

User avatar
schumaku
Guru
Posts: 43673
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Virtual host not working

Post by schumaku » Wed Nov 14, 2012 2:09 am

A "basic" Web server does listen on the IP address only.

A Virtual Server does work based on the requested URL - which must be a hostname or an FQDN. This is site one and only way to differentiate - and to present the appropriate Web page or application. A virtual server can never be reached over it's IP address only (unless mapped to a dedicated IP address on top, too).

Lizzie
New here
Posts: 5
Joined: Mon Nov 12, 2012 12:11 pm

Re: Virtual host not working

Post by Lizzie » Wed Nov 14, 2012 12:28 pm

Thank you both, particularly Mr. Wilson. I am digesting all and will experiment this coming weekend. The long, detailed explanation was very clear; thank you. I will report progress (and complaints) soon.

Lizzie
New here
Posts: 5
Joined: Mon Nov 12, 2012 12:11 pm

Re: Virtual host not working

Post by Lizzie » Sat Nov 17, 2012 12:49 am

schumaku wrote:A "basic" Web server does listen on the IP address only.

A Virtual Server does work based on the requested URL - which must be a hostname or an FQDN. This is site one and only way to differentiate - and to present the appropriate Web page or application. A virtual server can never be reached over it's IP address only (unless mapped to a dedicated IP address on top, too).


Would you be kind enough to explain "unless mapped to a dedicated IP address on top, too" ?

I am thinking of picking up a block of static IP addresses, which seems like it would work based on what you have just said, but I don't understand the "on top too" concept.

Thank you!

User avatar
schumaku
Guru
Posts: 43673
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Virtual host not working

Post by schumaku » Sat Nov 17, 2012 3:13 am

One IP could be enough. The concept?

Browser requests www.virtual1.com -> the virtual1 Web is served.
Browser requests www.virtual2.net -> the virtual2 Web is served.
Browser requests www.virtual3.org -> the virtual3 Web is served.

Browser requests IP only: The Web server can't distinguish and provides the "base" Web page.

Lizzie
New here
Posts: 5
Joined: Mon Nov 12, 2012 12:11 pm

Re: Virtual host not working

Post by Lizzie » Sat Nov 17, 2012 4:35 am

schumaku wrote:One IP could be enough. The concept?

Browser requests http://www.virtual1.com -> the virtual1 Web is served.
Browser requests http://www.virtual2.net -> the virtual2 Web is served.
Browser requests http://www.virtual3.org -> the virtual3 Web is served.

Browser requests IP only: The Web server can't distinguish and provides the "base" Web page.


This must be so frustrating trying to explain to a visitor from a different planet. I think I have finally understood the virtual host concept. I am still dithering about real hosts, however. The NAS has two configurable ethernet ports. I am able to get more than one static IP. Instead of having two virtual hosts (resolving through name as opposed to numeric address), I am still trying to figure out if it is possible to have two real hosts on the NAS, resolving through different ports.

I am very grateful for your timely responses.

ste8604
Know my way around
Posts: 101
Joined: Tue Apr 13, 2010 8:24 pm

Re: Virtual host not working

Post by ste8604 » Wed Nov 21, 2012 12:28 am

if i want:
qnap console on port 443 (https) and webserver on 443 (https) is possibile with virtual host??
qnap 239proII firmware 4.0.2

Locked

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”