Luca favaro's picture

I just completed an installation of turnkey moodle.

Everything works fine except for one URL, the most important.

If I use the server IP http://xx.xx.xx.xx or https://xx.xx.xx.xx I can succesfully access the moodle page but if I try using the server name it fails with the following error

The requested URL /moodle/login/index.php was not found on this server

Even more strange if I use this url it will work but I do not want to use the SSL connection.

I am not a Linux guy and very little experience with application but I do understand networks so I cannot figure out how a hostname in the URL can be any different than an IP considering that The DNS mapping is correct.

Thanks for any help

Jeremy Davis's picture

I just tested this and it worked as I would have expected. It had the same behaviour for me whether I used http and https (regardless of using url or ip). Moodle does appear to require https for the login page though - it will redirect to https. It also appears that after login it defaults to continue using https. I could manually change to http though and pages still work fine for me. TBH that is ideal behaviour really - it is poor practice to transmit passwords over http as they can be easily sniffed.

It sounds like your server is not quite behaving quite the same as mine though - you reported that http doesn't work using url at all. Can you confirm that? If your behaviour is not the same as mine then something must not be quite right. Where are you running it? Is it on your LAN or over the internet? Maybe it is some sort of firewall issue or some other networking weirdness...!?

Alternately if your behaviour is the same as mine, but it's not what you want - looking through the TurnKey Moodle build code I assume that the https login page requirement must be default Moodle behaviour (not something set in TurnKey). I had a quick google but I couldn't find anything about a Moodle setting that could be adjusted. You could try posting on the Moodle forums!?

Luca favaro's picture


This environment is only accessible to my users internally so encryption is not required but I can certainly install our wildcard certificate to prevent the certificate error. I do not have any firewall between the server and the client.

I just discovered something new.

I have setup my DNS to map my moodle server to both as well as

If I try to access the webpage using the IP works, if I try using it works but if I try using IT DOESN"T!

This means that is embedded in the code and nothing else is accepted. I think this is really bad coding! most likely a bug.

Do you have any idea where I should I look to try to fix this issue?





Jeremy Davis's picture

To give you some idea of my testing environment; my (freshly installed v13.0 64 bit - see note at the bottom of this post) Moodle server is running as a VM on my Proxmox hypervisor with an ip of '192.168.1.x'. My local DNS setup has been broken for a while and I haven't got around to fixing it so for the interests of brevity I have just been using my local hosts file (on my laptop) to assign urls to it. I wouldn't think that would make a difference though as although the mechanism is different in essence it should be achieving the same ends (assigning a url to an ip)...

When I wrote my post last night I was actually using the url '' (how's that for ironic!) so following your report, I tested again with '' and that works for me too. I also tried '' and '' and even 'fred.flint.stone'. All work via http and https (although all still redirect to https when I login and all stay on https by default once logged in).

Following my tests I think that we can be assured that it isn't specificity something hardcoded into the TurnKey Moodle server config. Although TBH I'm not sure what specific to your server or network which might be causing this behaviour. In your OP you said that you'd "just completed an installation of turnkey moodle" so I assume we can rule out any config tweaks you've made to the server?

TBH It makes no sense at all to me that my server behaves exactly as I would expect it to but yours doesn't... AFAIK DNS shouldn't affect which port will work or not (http or https) so I'm pretty stumped really.

My first thought is that perhaps '' is already assigned to another machine (and there is a clash there), but the error you reported in your OP: "The requested URL /moodle/login/index.php was not found on this server" wouldn't make any sense in that context - how would it know to look in /moodle/login/index.php and why would https work but not http?!?

[edit/update] My apologies; I just realised that although my Moodle server was only installed last week, it is not a 'fresh' vanilla TKL v13.0 Moodle install - I have updated Moodle to 2.7 and had already done some basic config. Also as it hasn't been running it doesn't have all the latest security updates. So I just did a clean (really fresh!) install of vanilla TKL Moodle v13.0 to make sure we are comparing apples to apples. As it turns out though the behaviour is the same... Although it wouldn't let me use http while logged in (as admin) until I had completed the profile info (email, home town and country). After that behaviour was exactly the same as I stated above (including fred.flint.stone!)

Luca favaro's picture


I really appreciate all your work trying to help me out and thanks to all your detailed information I was able to figure out the reason of my problem.

I used wireshark to capture traffic from my browser to see if I could find a difference in traffic while accessing or and I noticed that the first captured packet already contained the wrong GET so I concluded it must have been my browsers.

I went into IE and cleared everything, links and cookies and that fixed everything!

I have to admit I am still a bit puzzled for what happened because I tested connectivity from at least three different windows machines and on my own laptop I tested it with IE and Chrome and I would get the same error everywhere.

The only logical answer I can find is that I used to run moodle on a different server and these URL might got cached on all these browsers...

The error URL was while the correct URL should be

There was that extra "moodle" that I believe referred to the old server's file structure.

Anyway, thank you again for all your help! I know I have to figure out how to install a wildcard SSL certificate on this moodle server... any suggestion?



Jeremy Davis's picture

And really glad that we got the bottom of your issue (and resolved it).

TBH I haven't done much with SSL certs. Seeing as TurnKey is Debian under the hood (v13 = Debian Wheezy) and the Moodle appliance is built on the LAMP appliance (i.e. Apache is the web server) then google should probably be able to head you in the right direction.

Off on a bit of a tangent, not that basic SSL certs are that expensive, but seeing as this is purely for internal usage, then maybe you could always set yourself up a local cert authority. I've never done it but always intended to have a muck around with it...

Add new comment