Forum

Default and virtual host problems

Paul B.
15 August 2015, 00:55
Hi,

I've got Hiawatha installed on LinuxLite, a ubuntu 14.04 derivative. I forwarded ports 80 and 443 to my host machine, and it can be accessed from another computer.

But I'm not making much sense of the webserver specs. Here is my .conf file:
# DEFAULT WEBSITE
Hostname = 127.0.0.1
WebsiteRoot = /var/www/hiawatha/welcome
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi

But when I put in my domain name, it is not /var/www/hiawatha/welcome/index.html that appears, it is the original /var/www/hiawatha/index.html file.

And I don't know what to put for Hostname in the virtual host, or how to access it externally.

VirtualHost {
Hostname = grc
RequireSSL = yes
WebsiteRoot = /var/www/hiawatha/grc/public
StartFile = index.php
AccessLogfile = /var/www/grc/log/access.log
# ErrorLogfile = /var/www/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP5
# UseToolkit = banshee
}

Sorry, this is over my head at the moment. On Windows I used HFS, which I could sort of handle. Any help would be appreciated.

Paul
Hugo Leisink
15 August 2015, 08:03
The hostname in the configuration must match the hostname you use in the URL bar in your browser. Hiawatha does a simple string compare to determine which virtual host record it will use.
Paul B.
15 August 2015, 20:00
Thanks, Hugo,
I've been trying to resolved this, and had tried changing the virtual host to the full domain name, but only went backward. Now there is no connection from outside to the host machine.

I rechecked my router settings, I dropped the linux firewall, I substituted the default hiawatha.conf with minimal required changes. Nothing.

Then, still with firewall down, I stopped hiawatha, fired up HFS and tried to change it to port 80, as a test of my hiawatha setup. HFS would not allow me to switch to port 80. It says "cannot open port. Something is blocking".

I'm at a total loss what that might be.
Paul B.
15 August 2015, 20:34
It seems to be working now when I use both the external and LAN IP addresses of the host. Maybe the server needs to be stopped/started after each change? But when I use my domain name the index.html file for the virtual server, not the default server, is not the one specced, and is downloaded rather than displayed. That file's permissions allow Others to Read. This is the current virtualhost setting:
VirtualHost {
Hostname = grc.duckdns.org
WebsiteRoot = /var/www/hiawatha/grc/public
StartFile = index.html
# AccessLogfile = /var/www/my-domain/log/access.log
# ErrorLogfile = /var/www/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP5
# UseToolkit = banshee
}

It's downloading the index file specced at Default Website, /var/www/hiawatha/welcome, rather than the one at /var/www/hiawatha/grc/public.
Paul B.
15 August 2015, 22:26
After quite a while idling, now the domain address is pulling up the correct index file. I guess the key is re-initializing the settings, but I did stop/start hiawatha, so I'm not sure why that wasn't adequate.
paul b
15 August 2015, 23:15
For some reason, .conf changes are now reflected immediately. But despite adding ShowIndex = yes to the virtualhost, I haven't a clue how to show a local folder on the index page. This is probably too above my head and I don't want to be a burden to the forum.
paul b
16 August 2015, 06:23
I've actually got this thing working, except for some problems. I think browser cache on the client side was part of the problem. So I'll start a new thread.
Hugo Leisink
16 August 2015, 09:33
It's hard for me to tell what's going wrong based on the information you provided. But to me, it sounds like a network issue and not a Hiawatha issue.
paul b
16 August 2015, 13:20
It may well be, because I just encountered some other strange network behavior on the client machine this morning.
paul b
16 August 2015, 17:44
Indeed. I discovered it is necessary to give the server a dhcp name under the network connection daemon. I thought this would be taken care of automatically when naming the machine, but as soon as I entered it everything began going smoothly on the client machine. Something I won't forget.
Hugo Leisink
16 August 2015, 20:18
Make mistakes, discover your mistakes and fix them. That's the best way to learn.
paul b
17 August 2015, 14:35
Amen. There is no substitute for patient persistence. Great piece of work, Hiawatha. Thank you!

I've found that my router is failing. It's not retaining the local server's hostname. Just ordered a replacement.
This topic has been closed.