error 524 when clicking on "Site Administration"

error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -
Number of replies: 12

Hi,

I am new be in Moodle. Recently I encounter a problem which I dont know how to resolve it.

I will appreciate anybody which helps me.

Problem:

When I sign-in successfully to moodle & then click "Site Administration", my website doesnt respond until it gives me a 524 Error.

I use Cloudflare for security. Greylisting is Off.

I was working without problems for 3 months but recently face this problem.

Please HELP!

Average of ratings: -
In reply to Nima Zarin Parsa

Re: error 524 when clicking on "Site Administration"

by Ken Task -
Picture of Particularly helpful Moodlers

What version of Moodle?   On what platform?  Self-hosted or remotely hosted with whom?

If one is concerned about security of Moodle, been my experience that, as long as one keeps it up to date, runs https (valid cert), and doesn't go 'plugin happy' + install on your own server (depending upon platform) something that is a Web Application Firewall ... mod_security ... (which you can control) then server is pretty secure - and don't think I need CF for such.

2 cent opinion of course,

'SoS', Ken

In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -

Hi ken,

Thanks for your quick reply,

Version 3.8.0 on Linux lite speed platform & remotely hosted with cpanel (no whom).

I am so confused why only when clicking on "Site Administration" ????

Cloudflare seems to work without any problem. Only no response from server in a/m situation.

Attachment 2020-05-24.png
In reply to Nima Zarin Parsa

Re: error 524 when clicking on "Site Administration"

by Ken Task -
Picture of Particularly helpful Moodlers

Version 3.8.0 on Linux lite speed platform & remotely hosted with cpanel (no whm).

Translation:?   LiteSpeed your web server?

cpanel is not an operating system ... it's only an interface into configuring
the operating system.  What is operating system?  Ubuntu? Version?

And 3.8.0 is first release of that series ... now 3.8.3 ... suggesting probably
been some fixes to code.   So suggest once this is resolved ... or changed ... update the code.

Can you access your cpanel?

cpanel is normally a url with an IP address and port.

Mind sending that info to me via PM in Moodle here?  Just the IP address .. am not volunteering to login as you to investigate.

In your config.php file do you have a line like this:

$CFG->admin='admin';

If not add it.

Also in config.php, what's $CFG->wwwroot?

CloudFlare requires you to change your DNS.
https://websiteforstudents.com/how-to-install-moodle-with-apache2-and-cloudflare-cdn-ssl-on-ubuntu-16-04-18-04/

the fully qualfied domain name of server: portal.expertacademy.company

portal.expertacademy.company. 300 IN    A    104.31.75.205
portal.expertacademy.company. 300 IN    A    104.31.74.205

NetRange:       104.16.0.0 - 104.31.255.255
CIDR:           104.16.0.0/12
NetName:        CLOUDFLARENET

Those are as you can see, CloudFlare IP addresses.

The link sent previously suggested reasons and things to try ... those things to try all related to CloudFlare ... not Moodle.

For reference previous link had this item:

"If you need to have scripts that run for longer than around 100 seconds without returning any data to the browser, you can’t run these through Cloudflare. There are a couple of options: Run the scripts via a grey-clouded subdomain or change the script so that it kicks off a long-running background process and quickly returns a status which the browser can poll until the background process has completed, at which point the full response can be returned. This is the way most people do this type of action as keeping HTTP connections open for a long time is unreliable and can be very taxing also."

Don't hack core code ...  so in config of php (php.ini) ... there are settings for how long a script can run - set it over 100 seconds.

but note what it says:

This is the way most people do this type of action as keeping HTTP connections open for a long time is unreliable and can be very taxing also.

For all reasons above, I wonder if CF Security and Protections are really necessary.  Especially if CF has an adverse affect on running a Moodle ... whose security is pretty solid.  And like I suggested already, one could add protections with things like mod_security/Securi ... but that depends upon web server running .... LiteSpeed might not be able to use them.

'SoS', Ken


In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -

Hi Ken, 

Sorry for my bad reply,

This is my exact information for server:

Hosting PackageSpecial 5
Server Namelinux4
cPanel Version86.0 (build 17)
Apache Version2.4.43
PHP Version5.6.40
MySQL Version10.2.31-MariaDB-cll-lve
Architecturex86_64
Operating Systemlinux
Shared IP Address(((((Sent in PM)))))
Path to Sendmail/usr/sbin/sendmail
Path to Perl/usr/bin/perl
Perl Version5.16.3
Kernel Version3.10.0-962.3.2.lve1.5.28.el7.x86_64

Ok, I will update the code. I am afraid of losing data. Please send me any link regarding safe upgrade! I will apreciate.

I checked  "$CFG->admin='admin'; " & I had this is config.php.

My  $CFG->wwwroot is my domain 'https://portal.expertacademy.company'



In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -
Ken,

I am getting mad!!

I have to sites:
expertacademy.company
portal.expertacademy.company

I HAVE NO PROBLEMS IN ANY PAGES OF ABOVE SITES except when I am signed in as "Admin" in portal.expertacademy.company & only when clicking on "Site Administration".... All other sections like Messaging, profile, home page or any other pages are working nice.
When I click on "Site Administration" It freezes for some time then.... error524
Due to this problem also I cant go to Notifications area for upgrading the moodle

OMG!!!!! Please save me
In reply to Nima Zarin Parsa

Re: error 524 when clicking on "Site Administration"

by Ken Task -
Picture of Particularly helpful Moodlers
Ok, you don't have to keep repeating what you've posted as a problem.
Yes ... error 524 that *clouldflare* is reporting ... I get it.

Did you read this page:
https://community.cloudflare.com/t/community-tip-fixing-error-524-a-timeout-occurred/42342

Quick Fix Ideas from link above - quick summary below ... ***but do READ the page link above***

#1 says to check long running processes. ...


#2 says ... longer than 100 seconds ... blah, blah, blah ...
**** If you have a Cloudflare Enterprise plan, contact Cloudflare Customer Support to make them aware of the issue to investigate options.****


#3 says ... check server health ...

#4 If you need to have scripts that run for longer than around 100 seconds without returning any data to the browser, you can’t run these through Cloudflare.

Seems those 4 keep kinda repeating scripts/processes - returning data that runs over 100 seconds.

About the only thing I can think of in Moodle that might do that is the cron job.
Is your cron job running a wget ... which is a web service hit.  OR is it using path to php ... path to moodlecode/admin/cli/cron.php

Create a pinfo.php page and put it in document root - where you find config.php
file in moodle code.

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:php_info

Hit the page with a browser directly:
https://site/pinfo.php

In the core section, look for setting related to how long a script should run.
max_execution_time
max_input_time

Increase the values for those over 100.  Restart Litespeed web service.

And let me repeat ... I don't run Litespeed ... I don't use CloudFlare.

'SoS', Ken


In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -

Hi Ken,

Yes, I read the link completely,

1. I dont have any long running processes in server but found below errors (snapshot).

2. I dont have any enterprise Cloudflare, only general one. Nothing existed to overload server.

3. Server Health is OK

4. But I put the portal on grey mode for not proxied by cloudflare.

Below screen shows my only cron job which I configured at the beginning of serven installation. Really I am not sure if i have to set more cron jobs.

Also I updated the Moodle to the latest 3.8.3+, but the error remains.

I made the pinfo.php file as instructed in Litespeed support link.

Attachment cron.png
Attachment errors.png
In reply to Nima Zarin Parsa

Re: error 524 when clicking on "Site Administration"

by Ken Task -
Picture of Particularly helpful Moodlers

Well, we're making progress .... slowly ..and learning our server environment.

So you've made the pinfo page and can see the settings for time for scripts to run etc.  Did you try setting those higher ... defaults are normally low ... like 30 or 60.
Granted those are intended for local server processing, but let's remember how having CF in the middle is supposed to work ... all data goes through CF ... across a network you can't control.  According to the page, if CF can't get whatever in 100 seconds ... error 524.

In the error logs shared ... remember, I don't run Litespeed so pardon my dumb question ...
lines do say 'info' but I see the loopback IP address - 127.0.0.1 and a port + APVH
with 404 errors .... file not found ... for 'index.php'.

Huh?


Here's a link to/for Wordpress issues with Litespeed 404's
https://www.basezap.com/solved-404-error-on-wordpress-website-on-litespeed-webserver/
appears Litespeed uses .htaccess files.  Got any in your setup?
If so, what does it contain?
Compare what you have to advice given in link above.
Am not saying that will fix this ... just doing some leg work for you.

Cron job ... you've got it pointed to the cron.php script in /admin/ and that should require you to pass a password with the URL.  There is a cron.php in /admin/cli/ you should be using.

So it should be if using curl
curl -k https://yoursite/admin/cli/cron.php

Note that uses the web and pointed to /admin/ the area you can't get tol!!! Am wondering if that somehow gets routed to CF and thus is your issue.  Cron jobs could run longer than 100 seconds!!!

However, cron job best if running right in/on server ... and just php talking to the cli/cron.php script.  Never leaves your server - internal only ... no networking involved thus NO CF!

LIke so ... and so you know it's running I'd do a redirect to a log file you create:

/usr/bin/php /path/to/moodlecode/admin/cli/cron.php > /var/log/moodle-cron.log

rather than the redirect to 'la-la-land'.

Above assumes your server logs are in /var/log/  if not there adjust.

To create the log file, as root user:

touch /var/log/moodle-cron.log

That creates a blank/nothing in it file to which output of the php running of the cron.php script is redirected.   Why?   If need be one can watch it execute in real time with:

tail -f /var/log/moodle-cron.log

Also /usr/bin/php is a guess ... on a LS system ... you do want the PHP-CLI not PHP used for the web.

Test: /usr/bin/php -v

If you do not see php-cli in output of version, wrong php.

Ok, I've taken this about as far as I can ... don't run litespeed .. don't use cloudflare - so I have NO ... none .. nada .. first hand experience with either.

Best of luck!

'SoS', Ken

In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -
Hi Ken,

Thank you very much.
I found that my host firewall randomly blocked my interactions. Nothing was wrong in my Moodle. So I decided to change my host.
You helped me & I appreciate this.
I am migrating to GreenGeeks. They have a very nice support & I really liked their green policy to help earth.
In reply to Nima Zarin Parsa

Re: error 524 when clicking on "Site Administration"

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  Did you mention where you were hosted (old hosting)?   That info might be useful for others facing similar issue.

'SoS', Ken

In reply to Ken Task

Re: error 524 when clicking on "Site Administration"

by Nima Zarin Parsa -

Yeah, That was a local host in Iran named "hostiran.net"

Terrible.