Installing Moodle on NGINX - No CSS

Installing Moodle on NGINX - No CSS

от Michael Iscool -
Number of replies: 13

Hello!
I need help with installing Moodle on my dedicated Ubuntu 14.04 server.
On it I have my Joomla 2.5, 3.0 websites and BigBlueButton (BBB), all of which run flawlessly on the server.
My websites run on nginx, since BBB requires it.
I've tried setting up Apache2 + nginx, but somehow this setup doesn't want to work properly, so I'm using nginx only.

Any help will be appreciated, since I'm out of ideas and my hosting support is basically useless.

The goal

I'm transferring my websites from a VPS hosting to a Dedicated server.
Since Joomla works fine, I need to make sure that Moodle does as well.
Before transferring the main domain, I need to test a copy of the Moodle website on my test domain.

The issue

After uploading the website copy I check the result only to see a "naked" html page without css. (img.1)
Which is strange, because, like I said, my other websites work fine

So I decided to upload a blank Moodle, for a clean install.
The first few pages of the installation were fine, the css was present.
After the Server Checks page I'm redirected to a blank installation page. 
The page remained static, even after an hour of waiting.

Restarting the page corrupts the installation, which may be the reason for the missing css.
BUT! If I swap nginx for apache2, the css is displayed normally.

Installing with Apache2

So I decided to install Moodle with apache2 running instead of nginx. 
Everything went smooth, I even got to see the Installation page and a gradually growing list of installed plugins.
Then the installation process froze on the auth_mnet plugin.
I waited for a descent amount of time, before reloading the page.
After the reload I was redirected to the Plugin check page where I clicked Update Moodle database.
The rest of the installation process went as it should and I got my moodle page, which had css.
Though the page content was only covering the left half of the page (img. 2)

Since everything installed correctly I swapped everything back to nginx.
But all I get is that naked page... (img. 1)

Nginx sites-available settings for the domain

server {
 listen   80; 
 ## listen for ipv4; this line is default and implied	
 #listen   [::]:80 default ipv6only=on; ## listen for ipv6
 #root /var/www/skypespanol;
 root /var/www/scoolcom/data/www/skypespanol.ru;
 index index.html index.htm;
 # Make site accessible from http://localhost/  server_name skypespanol.ru www.skypespanol.ru;
 location ~ \.php$ {   try_files $uri /index.php =404;   fastcgi_pass unix:/var/run/php5-fpm.sock;   fastcgi_index index.php;   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;   include fastcgi_params;  }
 location / {   autoindex on;   index index.php index.html index.htm;   # try_files $uri $uri/ /public/index.php$request_uri;   try_files $uri $uri/ $uri/index.php;  } }

Images

img. 1


img. 2


In reply to Michael Iscool

Re: Installing Moodle on NGINX - No CSS

от Visvanath Ratnaweera -
Снимка на Particularly helpful Moodlers Снимка на Translators
In reply to Visvanath Ratnaweera

Re: Installing Moodle on NGINX - No CSS

от Marcus Green -
Снимка на Core developers Снимка на Particularly helpful Moodlers Снимка на Plugin developers Снимка на Testers

I recommend you go the Apache route on the basis you will be running the same web server as about 99.9% of all other Moodle sites and so will be in a better position if you ever need to ask questions. I suspect you have a permissions problem not a webserver or Moodle problem, but that is just a guess.

In reply to Marcus Green

Re: Installing Moodle on NGINX - No CSS

от Visvanath Ratnaweera -
Снимка на Particularly helpful Moodlers Снимка на Translators
99.9% Moodles running Apache? From where did you get the number?

Amoung all the web servers, Apache has a share of 35%: http://news.netcraft.com/archives/2015/10/16/october-2015-web-server-survey.html.
In reply to Visvanath Ratnaweera

Re: Installing Moodle on NGINX - No CSS

от Marcus Green -
Снимка на Core developers Снимка на Particularly helpful Moodlers Снимка на Plugin developers Снимка на Testers

Like most implausible statistics you read in public I just made it up.  A more realistic correction to my statement is that the vast majority of Moodle installations are not running NGINX, and there is a huge reservoir of knowledge of people who run Moodle under Apache.

This is nothing against NGINX, just advice to go where the most knowlege is.

 

In reply to Marcus Green

Re: Installing Moodle on NGINX - No CSS

от Visvanath Ratnaweera -
Снимка на Particularly helpful Moodlers Снимка на Translators
I didn't canvas against nginx, that is what the OP wanted. See the subject line.

To talk of "vast majority" one needs numbers. The world-wide numbers, 34.53% Apache : 16:65% nginx, tell a different story. See the October stats from Netcraft I've provided earlier.

About the huge reservoir of knowledge, in addition to the links I've provided, a Moodle forum search, https://moodle.org/mod/forum/search.php?id=5, gave me plenty of discussions, amoung others:
- https://moodle.org/mod/forum/discuss.php?d=319812
- https://moodle.org/mod/forum/discuss.php?d=314248
- https://moodle.org/mod/forum/discuss.php?d=283326
- https://www.digitalocean.com/community/tutorials/how-to-install-moodle-via-git-with-postgres-nginx-and-php-on-an-ubuntu-12-04-vps
- https://moodle.org/mod/forum/discuss.php?d=234656
- https://moodle.org/mod/forum/discuss.php?d=205218
In reply to Visvanath Ratnaweera

Re: Installing Moodle on NGINX - No CSS

от Marcus Green -
Снимка на Core developers Снимка на Particularly helpful Moodlers Снимка на Plugin developers Снимка на Testers

"I didn't canvas against nginx, that is what the OP wanted. See the subject line."

I didn't think you did, neither am I, however I'd like people to know where the most knowledge is in reference to hosting Moodle.  The body of the original message appeared to suggest that Apache was an alternative.

"To talk of "vast majority" one needs numbers."

One needs relevant numbers and in the context I was commenting on was the web server used to host Moodle. Even more than that, the hosting of Moodle where the person doing has the potential to offer advice or contribute knowledge. 

There is no equivalent of a Netcraft survey of Moodle hosting, but a reasonable proxy might be what web servers are mentioned in the Moodle forums. I just did a search in the Moodle in English for the terms Apache, IIS and NGIX

The numbers came out as follows


apache 19722
iis 8898
NGIX 28



In reply to Marcus Green

Re: Installing Moodle on NGINX - No CSS

от Paul Verrall -

Most people eat too much junk food and don't do enough exercise, doesn't mean you should too намигване Nginx is light, fast and IMO easier to configure than Apache, plus is works just great with Moodle.

Maybe NGINX is mentioned less because it causes less problems... or, more likely, because it hasn't been as popular for as long as Apache... Certainly though if we keep shoehorning people into using Apache because it is popular it is a self fulfilling prophecy.

Really though, just use what you are most comfortable with усмивка

Now I am off to write a script to query all the registered sites in the Moodle database to see what they are running!

In reply to Paul Verrall

Re: Installing Moodle on NGINX - No CSS

от Visvanath Ratnaweera -
Снимка на Particularly helpful Moodlers Снимка на Translators
Hi Paul

Thanks for the encouragement!
намигване

I have my test instance on a Raspberry Pi, http://www.syndrega.ch/?p=108, haven't done much of a testing though.

The 16.65% share for nginx in http://news.netcraft.com/archives/2015/10/16/october-2015-web-server-survey.html is impressive, I must say.
In reply to Paul Verrall

Re: Installing Moodle on NGINX - No CSS

от Marcus Green -
Снимка на Core developers Снимка на Particularly helpful Moodlers Снимка на Plugin developers Снимка на Testers

The flaw in that analogy is the idea that Apache is the equivalent of junk food.  For most users one of the most important thing when using software is the amount of support they can get for it. 

It is an interesting idea that NGIX is mentioned less because it causes problems. I don't think that is true, but it is a worthwhile way of looking at such issues. It certainly is true that it has not been as popular for as Long as Apache. My resistance to the charms of NGIX might be compared with a view back around 2001 that said, "This Moodle might be OK, but it is new and untried, and there is little support, you would be better off going with something popular and tested such as Blackboard". 

I have heard only good things about NGINX, and if you are technically skilled and/or have specific needs then consider it for your solution.



In reply to Michael Iscool

Re: Installing Moodle on NGINX - No CSS

от Michael Iscool -

Update

The css error can be resolved by disabling slasharguments.
The installation freeze is fixed by raising the php upload time limit and max file size limit.

Now I need to find out why my page is displayed with 50% width.

In reply to Michael Iscool

Re: Installing Moodle on NGINX - No CSS

от Matteo Scaramuccia -

Hi Michael,
that is a possible workaround but please, fix your nginx configuration according with the Moodle Docs: slash arguments is required for e.g. SCORM activities or HTML mini-sites and it will be required in Moodle starting from 3.1.

HTH,
Matteo