Apache will not serve moodle

Apache will not serve moodle

by Chris m -
Number of replies: 17

I am using moodle 3.1 with the date $version  = 2016052300.03 found in the version.php file.

This is on a centos minimal server with virtualmin.

I have already checked your forum and ensured that usual problems are not responsible for this issue. The files are in the webroot, the directory index is set to include index.php, and the ownership is set to the user of the virtual machine. Typically once I do all of these things my sites work fine but this time I still get the "index of /" message or the "This site under construction" message, depending on the browse used.

I have checked the logs and found no errors relating to this problem and at present no logging of hits to the site are being made. I checked the apachectl configtest. I get one error there, suexecgroupuser is being called without a suexec directive. I'm not really up on this so I came here to ask for advise.

Any help will be appreciated,



Average of ratings: -
In reply to Chris m

Re: Apache will not serve moodle

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

suexec is a security feature, read e.g. http://www.auburn.edu/docs/apache/suexec.html, which is not needed for Moodle. You need to disable it. How exactly depends on the server environment. Since you mentioned CentOS I would look at SELinux first, do a test run with SELinux deactivated.
In reply to Visvanath Ratnaweera

Re: Apache will not serve moodle

by Chris m -

I was under the impression that this suexec was about file permissions so that apache is able to access the files that the Moodle user owns. I did check the Moodle group, and apache is a member so it does seem redundant.

Also, suexec is not present, only the suexecgroupuser directive is there. Which, from my reading is why the configtest is giving an error. Should I remove the suesecgroupuser directive or is it more complex than that? Virtualmin generates the config file automatically. So it will take some reading to figure out how to remove this directive.

In reply to Chris m

Re: Apache will not serve moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

How did you install PHP on your server? 

It just sounds as though PHP is not properly configured. 

In reply to Howard Miller

Re: Apache will not serve moodle

by Chris m -

PHP is installed automatically with the virtualmin set up. Its been about 2 years since I have set up a virtualmin machine but last time that I did, Moodle worked on it without any modifications to PHP. Obviously, there have been many upgrades in many of the packages that make up the virtualmin system in that time so it is possible that something has changed. However, if there was a problem with the PHP settings, would that not show up in the error logs?

In reply to Chris m

Re: Apache will not serve moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've never heard of virtualmin so you have the advantage of me there. 

If there's any doubt about PHP I would check you can run the minimum PHP file.... Call it test.php, put it in your web root (or even better, the same place as Moodle) containing...

<?php
    phpinfo();

Then try to access it from your browser. You should get a very long page of all your PHP settings. If that doesn't work, Moodle certainly won't.

In reply to Howard Miller

Re: Apache will not serve moodle

by Chris m -

I tried this test and received this result:

Not Found

The requested URL /test.php was not found on this server.

I also tried using an index.html test file with the same result. I checked to ensure that the file owner was the moodle user in both cases. Any ideas?


As for Virtualmin, it usually handles all of the minutia of setting up the environment correctly. That is why I use it. This is a new version that I am using for the first time. So it is not totally above suspension but it has proved pretty good in the past.

In reply to Chris m

Re: Apache will not serve moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You either put the file in the wrong place or you typed the wrong address for that location into the browser.

That's slightly flippant I know but it indicates a configuration problem with your web server rather than any Moodle problem. What's your DocumentRoot set to in the Apache configuration? In fact, is this just the normal Apache that comes with CentOS? If you didn't change anything the web root should be /var/www/html 

In reply to Howard Miller

Re: Apache will not serve moodle

by Chris m -

I'm sure its in the right place. Virtualmin creates a folder for use as the webroot. /home/moodle/public_html

Which as you can see is pretty obvious where things go.

As for the address, I used a link that virtualmin generated. So I am sure that I am correct there, as well. I think that you are right that Apache is the problem. There probably some esoteric setting that I am unaware of.

So far I have checked the webroot, directory index, and file ownership. The files are owned by the user moodle and the group owner is moodle. The apache user is set to be a member of the moodle group. In the past this has always been enough to get things working.

If it helps I can upload a copy of the config file. Does this site use the <code> tags? If you guys don't think you can help, I could try the apache forums directly. Unless you have any other ideas (either troubleshooting or a good forum for this problem).

Chris

In reply to Chris m

Re: Apache will not serve moodle

by Albert Ramsbottom -

If you are sure you have put this file in the right place then its apache that isnt working, not moodle

Whats your document root in your apache.conf file?

What moodle user???, do you mean apache user or www-data user?

Albert

In reply to Albert Ramsbottom

Re: Apache will not serve moodle

by Chris m -

The moodle user is a system (linux) user. As I mentioned before I am using Virtualmin. Virtualmin is basically a hosting system. It automatically creates (from a domain name and a password) an Linux account, Apache virtual server, email server, SSH, FTP, webDAV, and other services all at once, all with the domain name as the UID. I use this because it handles all the config files for all this automatically. In general, I know what the Apache directives are individually  but I have problems stringing them together into a working config file. Virtualmin handles this for me and this is why I really like Virtualmin. Right now I am in the middle of trying to get an updated version of Virtualmin to work with the new Moodle. I'm sure there is a simple problem somewhere and its probably an easy fix. But at this point, I have changed everything and it is difficult to locate that simple problem.

As for the webroot, it is in /home/moodle/public_html/. This is because the web root has to be in the home directory of the user because there is the possibility or many users, each with their own website.

I hope this answers your questions and explained what Virtualmin a little,

Chris


In reply to Chris m

Re: Apache will not serve moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Virtmin is a 'special' version of Webmin designed to be like GoDaddy/Other Provider's set ups on shared host.

http://www.webmin.com/virtualmin.html

Have used Webmin before to do the same when creating users for a CentOS server and pre-building a 'skelton' directory that would be copied to the 'users'/customers /home/[customername]/public_html/ directory.    That's kinda what VirualMin does ... is that correct so far?

Virtmin can, I think, set up what one would call a home directory which is really the domain a customer chooses to use (this assumes the FQDN is available and configured prior to the configuration of the customers space ... like /home/[customerID]/FQDNofsite/public_html/

Customer ID (or login) has be part of the apache group for apache tor be able to handle 'user space' and the customer to have it easy to be able to upload/control their space by their login name.

So this issue really is a overall issue with config of Virtualmin and not of Moodle.

The catch 22 in using VirtualMin will be the location of moodledata directory.   Moodle code requires it to be outside of publically accessible/browseable directories in user space.   Hosting providers get around that by using .htaccess in moodledata.

So for somone to help with this ... you will have to disclose much more than you have ... example: /home/moodle/ can't be used by all customers.  Now /home/bjones/public_html/[moodleocodehere] could be used ... as well as /home/FQDN/public_html/[moodlecodehere] could also be used.

Check out the httpd.conf file on your system (assumes CentOS - if Ubuntu/other that could be apache2.conf.    In 5,6 of CentOS ... possibly in 7 ... there is this section that could be involved:

# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /home/*/public_html>
#    AllowOverride FileInfo AuthConfig Limit
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    <Limit GET POST OPTIONS>
#        Order allow,deny
#        Allow from all
#    </Limit>
#    <LimitExcept GET POST OPTIONS>
#        Order deny,allow
#        Deny from all
#    </LimitExcept>
#</Directory>

If pursuing this route ... strongly suggest building the skeleton directory for moodle code using git ... version 3.1 of Moodle.    This will enable users to update their Moodle easily IF they are granted ssh into their own space AND git is available to all users on the system.

Even if 'customers' don't want to do that and you offer, for additional fee, of course, an update/upgrade service it will be extremely easy for you to update and/or upgrade.   Because it's so easy to update or upgrade a Moodle via git customers would be pleasantly surprised to see additional fees for such to be very reasonable ... how about $15.00 US.    That would include a full site backup (code, DB, and data directory in user space) prior to update/upgrades.

Hmmmm ... means you're gonna have to have a hefty machine ... and more than likely a dedicated DB server to handle multiple customers.

Free advice ... ;)

'spirit of sharing', Ken



In reply to Chris m

Re: Apache will not serve moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

So Virtualmin 'knows' about Moodle and creates a webroot magically called /home/moodle/public_html. I'm not saying I don't believe you.... it just sounds highly unlikely. 

In normal Linux land that would produce a Moodle URL something like..

http://my.linux.server/~moodle

However, like Ken says, I think there's something you are not telling us (or maybe are not aware of) about where that directory came from. And, more to the point, you need to justify why you think that is the web root.

'Virtualmin did it' is not a good enough answer, sorry.

In reply to Howard Miller

Re: Apache will not serve moodle

by Just H -

I think you'll find "moodle" in this case is just the name of the user not Moodle the software, it could just as easy be "home/fred/public_html" as it is in this case "home/moodle/public_html".

Virtualmin/Webmin are basically opensource WHM/cPanel alternatives.

In reply to Chris m

Re: Apache will not serve moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Since you mentioned an "suexecgroupuser is being called without a suexec directive"

here's the official doc:

https://httpd.apache.org/docs/trunk/suexec.html

on that page there is a section on setting up, using, and debugging.

The using section has info on virtual hosts and on user directories ... which I think would pertain.   There is also a debugging section: The output of "suexec -V" will show the options used to compile suexec,

There should be available a /var/www/html/ directory that might be accessible by IP address only.   Try placing the phpinfo.php file in there and use IP address to access.

PHP should be system wide ... all sites ... and one can find all the ini's for extensions in /etc/php.d/

There is also a difference in CentOS 6 and CentOS 7.   The latter is more like Debian/Ubuntu now which, I would imagine, relate to how Virtmin configured.

'spirit of sharing', Ken