Cannot create virtual host

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
gschmott
New here
Posts: 2
Joined: Sun Feb 01, 2015 1:20 am

Cannot create virtual host

Post by gschmott »

I am attempting to create a virtual host on my NAS and have run into some difficulty. This should be simple but thus far a solution has eluded me.

I have a TS-212P running firmware 4.1.2. I followed the instructions detailed in the user guide (QTS_user_manual_Home_eng_4.1.pdf, p. 193).

1. I went to "Control Panel" > "Applications" > "Web Server" to enable the web server.
2. I selected "Enable Web Server".
3. I selected "Enable secure connection (SSL)" and used the default port (8081)
4) I hit "Apply All" and it seemed to work. Looking in the system log it says "[WebServer] Started successfully."
5) I go to the "Virtual Host" tab
6) I select "Enable Virtual Host" and click "Apply". Looking in the system log it says "[Virtual Host] Virtual host is enabled successfully."
7) I click "Create a Virtual Host"
8 ) I fill in the following information in the dialog:
Host name: testsite.duckdns.org
Select a folder /Web/testsite
Specify a port: 9443
Select: HTTPS

9) I hit "Apply". This cursor spins for a while. When it stops spinning there is *NO* entry listed in the box that shows entries for virtual hosts. Likewise, I see nothing in the log to indicate that it has successfully created a virtual host. The software provides no feedback, positive or negative, that anything happened.

Has anyone seen this behavior? Is is a bug in the new firmware? I can ssh into the NAS and poke around although I am not an Apache server expert by any measure. Is there anything I can do to manually confirm that something happened or (perhaps) manually configure this without using the Web GUI?

Thanks for any assistance someone might be able to offer.
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Cannot create virtual host

Post by pwilson »

Code: Select all

nslookup testsite.duckdns.org
Server:		10.77.13.1
Address:	10.77.13.1#53

** server can't find testsite.duckdns.org: NXDOMAIN
If you can't look up the "virtual host" via "nslookup" it won't work. The "virtual" hostname needs to resolve to your Routers external IP address. Create your "FQDN" first via your Dynamic DNS provider, and register it against your Routers external IP address. I could take several hours after creation for this FQDN to be resolvable across the Internet.

Simply keep using the "nslookup" command to see if it is resolving. You can also get the "nslookup" command to use different servers, so you can check multiple DNS servers on the Internet, for example you can check to see if your domain has propagated to Google's OpenDNS servers with:

Code: Select all

nslookup testsite.duckdns.org 8.8.8.8
Like this:

Code: Select all

nslookup testsite.duckdns.org 8.8.8.8
Server:		8.8.8.8
Address:	8.8.8.8#53

** server can't find testsite.duckdns.org: NXDOMAIN
Once your "FQDN" has properly propagated and your "nslookup" commands are working, then create it in the WebUI. If your domain can not be resolved, the WebUI will not allow you to create a "virtual host" within the WebServer for it.

If you want to serve up content for multiple Websites, simple register multiple FQDN's for your system, and then you can create a "virtual host" for each one. For example you could register "termperenceleague.duckdns.org" for your anti-alcohol website, and create "bobsbuzz4booze.duckdns.org" for your alcohol delivery service.

You could literally operate both websites on the same server, and the users of each one wouldn't know the other one exists.

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.
gschmott
New here
Posts: 2
Joined: Sun Feb 01, 2015 1:20 am

Re: Cannot create virtual host

Post by gschmott »

Thanks for the feedback . . . but I can't even get to the point of actually "creating" the virtual host entry from the QNAP GUI.

The "testsite.duckdns.org" is just an example - it doesn't actually exist. I verified using nslookup that my "real" FQDN actually does exist. This is not my problem. My problem is configuring Apache, via the QNAP GUI, to actually create an entry in its configuration files for the virtual host. When I go through all the steps I mentioned previously, there is *NO* entry in the list of virtual hosts (at least the GUI doesn't show it). I've done this before on an older QNAP NAS and never had a problem.

So, perhaps someone can suggest how I can manually add a virtual host entry to the Apache configuration files (or verify that the GUI is indeed failing). I'm not an expert on this particular topic but am quite comfortable around embedded Linux platforms and the command-line.

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

Re: Cannot create virtual host

Post by pwilson »

gschmott wrote:Thanks for the feedback . . . but I can't even get to the point of actually "creating" the virtual host entry from the QNAP GUI.

The "testsite.duckdns.org" is just an example - it doesn't actually exist. I verified using nslookup that my "real" FQDN actually does exist. This is not my problem. My problem is configuring Apache, via the QNAP GUI, to actually create an entry in its configuration files for the virtual host. When I go through all the steps I mentioned previously, there is *NO* entry in the list of virtual hosts (at least the GUI doesn't show it). I've done this before on an older QNAP NAS and never had a problem.

So, perhaps someone can suggest how I can manually add a virtual host entry to the Apache configuration files (or verify that the GUI is indeed failing). I'm not an expert on this particular topic but am quite comfortable around embedded Linux platforms and the command-line.

Thanks again . . .
I'm afraid I don't know what to tell you. I just setup two "Virtual Hosts" here. Both worked instantly.
Image

/etc/config/apache/extra/httpd-vhosts-user.conf

Code: Select all

NameVirtualHost *:80

<VirtualHost _default_:80>
	DocumentRoot "/share/Web"
</VirtualHost>
<VirtualHost *:80>
	ServerName XXXXXXXX.myqnapcloud.com
	DocumentRoot "/share/Web/dokuwiki"
</VirtualHost>
<VirtualHost *:80>
	ServerName YYYYYYYY.ddns.net
	DocumentRoot "/share/Web/orca"
</VirtualHost>
I'm on QTS 4.1.2 Build 20150126. Which Firmware are you using?

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.
visser.gvm
New here
Posts: 2
Joined: Sun Jul 24, 2011 5:28 pm

Re: Cannot create virtual host

Post by visser.gvm »

(me: gerard visser, holland. QNAP TS-219P+ firmware 4.1.2 date 20150126)

I am afraid that the problem only appears when trying to add a https-virtual server.
having the webserver runnig just on port 80: no problems at all,
starting the https-server on 443: i can still find the http-websites
adding a virtual host with https (on port 443) doesn't result in an entry in the virtual hosts-list.
changing a virutal host from http:80 to https:443 doesnt result in a change in te list

I would very much appreciate some-one else to test this https-issue too: i think there is something wrong and not only with my imagination....
(spent over 10 hours on it: have to deliver a "proof of concept" to a company with several small websites running)
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Cannot create virtual host

Post by pwilson »

visser.gvm wrote:(me: gerard visser, holland. QNAP TS-219P+ firmware 4.1.2 date 20150126)

I am afraid that the problem only appears when trying to add a https-virtual server.
having the webserver runnig just on port 80: no problems at all,
starting the https-server on 443: i can still find the http-websites
adding a virtual host with https (on port 443) doesn't result in an entry in the virtual hosts-list.
changing a virutal host from http:80 to https:443 doesnt result in a change in te list

I would very much appreciate some-one else to test this https-issue too: i think there is something wrong and not only with my imagination....
(spent over 10 hours on it: have to deliver a "proof of concept" to a company with several small websites running)
Of course you can't do that. Port 443 is used by NAS Admin WebUI. Your normal HTTPS Webserver lives on port "8081/TCP" rather than Port 443/TCP. :shock:

Image

My HTTPS Virtual Servers work here just fine:

Image

When I access http://XXXXXXX.myqnapcloud.com I get Dokuwiki.
When I access https://XXXXXXX.myqnapcloud.com:8081/ I get Wordpress.

Works like a charm.

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.
visser.gvm
New here
Posts: 2
Joined: Sun Jul 24, 2011 5:28 pm

Re: Cannot create virtual host

Post by visser.gvm »

Thanks Mr. Wilson for your clear answer.
I was already afraid for this answer.
Allthough i disabled the 443 port in the admin-tool, one cann't run a secure website on de galatic-standard port 443.
To me it is not that "of course".
So now we have to create an extra line in the fire-wall nat-table: not quite salable.
Just looking around for alternatives now.
Kind regards
User avatar
schumaku
Guru
Posts: 43578
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Cannot create virtual host

Post by schumaku »

visser.gvm wrote:Allthough i disabled the 443 port in the admin-tool, one cann't run a secure website on de galatic-standard port 443.
Disabling does not help - the port 443 remains reserved for the QTS Web UI.

If you intend to run small Web sites on https, it's strongly suggested to make use of the standard port - from strict corporate managed environment, other ports but 80/TCP and 443/TCP might be blocked. Do make this happen, change the QTS https port away from 443/TCP to 8443/TCP for example and enable https again.

Now you can make use of 443/TCP on the Web Server and the Virtual Web Server configuration.

Please note, this change might have to be deployed to mobile clients accessing QTS Web accordingly. Operating both the QTS and the Web server on 443/TCP is not possible.

Regards,
-Kurt.
Post Reply

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