Moodle version 3.0 is experiencing issues with loading CSS and Javascript due to compatibility issues with NGINX requests not matching the actual paths

Here is my current configuration:

  • Operating System: Ubuntu 14.04
  • Web Server: Nginx 1.4.6
  • PHP Version: 5.5.9
  • Moodle Version: 3.0

After successfully installing Moodle 3.0 through the browser, none of the CSS or JavaScript files are loading. The error logs from NGINX show the following errors:

2017/04/24 20:48:23 [error] 3277#0: *601 open() "/var/www/html/moodle/theme/image.php/clean/core/1493057621/moodlelogo" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/image.php/clean/core/1493057621/moodlelogo HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
...more error messages...

The issue seems to be that the path is misidentifying certain .php files as directories. Below is my server configuration:

server {
    listen      8080;
    server_name localhost;

    # Root #
    root /var/www/html/moodle/;
    index index.php index.html index.htm;

    location ~ \.php$ {
        if (!-f $document_root$fastcgi_script_name) {
            rewrite ^ 404;
        }
        include fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

I have attempted the solutions provided in the links below, but they did not resolve the issue:

Solution 1

Solution 2

Unfortunately, none of these solutions were successful in fixing the problem...

Answer №1

Ensure to include the following configuration code in the nginx.conf file on your server.

location / {
             root /var/www/yourwebsite.com;
             index index.php index.html index.htm;

             # moodle rewrite rules
             rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;
          }

      # php parsing
      location ~ .php$ {
                         root /var/www/yourwebsite.com;
                         try_files $uri =404;
                         fastcgi_pass unix:/tmp/php5-fpm.sock;
                         fastcgi_index index.php;
                         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                          include fastcgi_params;
                          fastcgi_buffer_size 128k;
                          fastcgi_buffers 256 4k;
                          fastcgi_busy_buffers_size 256k;
                          fastcgi_temp_file_write_size 256k;

               }

Answer №2

Here is my minimal nginx configuration that has been tested and works perfectly with Moodle version 3.1 and above.

server {
        listen 80;
        server_name example.com;
        root /var/www;
        index index.php index.html index.htm;

location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info  ^(.+\.php)(/.+)$;
    fastcgi_index            index.php;
    fastcgi_pass             127.0.0.1:9000;
    include                  fastcgi_params;
    fastcgi_param   PATH_INFO       $fastcgi_path_info;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

There was an issue with the routing that prevented access to the student activity information at

I've been working on building my own Note Taking App using Express. Following my instructor's example, I wrote some code but encountered an issue when deploying it. Whenever I try to add a new note, I receive an error that says "cannot get/api/na ...

"The art of communication: Websockets bridging the cross-domain

Currently, I am in the process of creating two web applications: The core application, developed using Java with Vert.x, is responsible for receiving data from various other apps and sending it to the client. The client application, built using PHP/JS, i ...

How can I retrieve and manipulate the text within an option tag of a form using JavaScript?

<select name="products"> <option value=""> - Choose - </option> <option value="01">table</option> <option value="02">chair</option> <option value="03">book</option> <option value= ...

Tips for creating gaps between list items in a collapsible navbar

I am attempting to add spacing between the li items in my collapsible navbar However, the issue arises when I slightly minimize the browser window, causing the navbar to collapse incorrectly. See image below: https://i.sstatic.net/TdKb4.png Below is t ...

I'm struggling to understand the reasoning behind the 'undefined' error occurring in the Google Maps distance service

Currently facing a puzzling issue with an 'undefined' exception. Developing a tool to track distance traveled between two locations, leveraging Google Maps distance matrix. Upon selecting a vehicle, entering an origin and destination, and clickin ...

Exploring request parameters within an Express router

I'm currently facing an issue with accessing request parameters in my express router. In my server.js file, I have the following setup: app.use('/user/:id/profile', require('./routes/profile')); Within my ./routes/profile.js fil ...

Subfolder is not generating the batch file

I need help troubleshooting this code. I created a temporary folder in the C drive, but for some reason the batch file isn't getting created. Can anyone provide some suggestions or insights? var sText, s; var fso = new ActiveXObject("Scripting.Fi ...

Ways to retrieve information from a URL using the .get() method in a secure HTTPS connection

As I work on handling user input from a form using node.js, express, and bodyParser, I encounter an issue. Even after using console.log(req.body), the output is {}. This is puzzling as there is data in the URL when the form is submitted successfully at htt ...

How can we troubleshoot webdriver cucumber when test steps are skipped due to passed arguments?

Greetings! I have a feature file outlined below in my cucumber webdriver test project: # language: en Feature: Simple Test, Int and Prod Origin vs non origin checks Simple cloud environment Checks @javascript @EnvCheck Scenario: Check Env TEST Orig ...

I encountered an error in my React project while compiling: "Module not found: Error: Can't resolve 'react-reveal'. What is this 'react-reveal' and why is it showing up in my

Issue with Module: Error: Unable to locate 'react-reveal Upon running "npm start" in my React project, I encountered this error. Despite attempting multiple solutions, the problem persists. How can I resolve this issue? Even after downloading the np ...

I utilized the explode function in PHP to transform a string into an array. Now, I require assistance with manipulating

Currently, I am facing a challenge where I have converted a string into an array in PHP using explode. I need to pass this array to a separate JavaScript page and then access the data values from within. Below is the structure of the array in JavaScript o ...

ASP.NET AJAX call fails to update the table due to null response

I am currently attempting to update my table by making an Ajax call using the following code snippet: var client = {}; client.ClientId = row.find(".ClientId").find("span").html(); client.Name = row.find(".Name").find("span").html(); ...

Encountering a problem during the transition from webpack 1.x to webpack 2.x, specifically related to the absence of an

Currently in the process of transitioning a project from Webpack 1 to Webpack 2, I've hit a snag with integrating eslint. In my existing Webpack 1 configuration, eslint is set up as follows: eslint: { configFile: path.join(__dirname, "eslint.core ...

Step-by-step guide on performing a GET request to the api.github using an Express server

I've been stuck for the past 3 days and have done extensive research on the internet. Here's the code snippet I'm struggling with: api.js const express = require('express'); const router = express.Router(); var http = require(&apo ...

Encountering a node-gyp rebuild error during the installation of node modules

My attempt to install the zerorpc package on node using 'npm install zerorpc' resulted in an error related to node-gyp failing to rebuild. The error message included: npm http GET https://registry.npmjs.org/zerorpc npm http 304 https://regis ...

Issue: [ng:areq] The parameter 'TasksCtrl' should be a function, but it is currently undefined

I seem to be encountering an error and I'm struggling to identify the cause. Is there something I overlooked? js var app = angular.module('Todolist', []); app.controller('TasksCtrl', [ '$scope', function($scope) { ...

Guidelines on incorporating HTML files as templates into Rollup and compiling them into concatenated strings

I am currently working on setting up a build process for Optimizely experiments using Rollup instead of Webpack. The reason for this change is that the code exported by Webpack is too bloated for our specific use case. My goal is to import .html files as t ...

Something seems off with my code. It's causing a barrage of errors to appear on the browser

JavaScript is a whole new world for me, and I'm struggling with all these errors. The goal here is simple: click the "generate" button, and under "Most Recent Entry," display the current temperature for the entered zip code, today's date, and th ...

Looking for assistance with properly updating pm2 in my Next.js project

When I update my NextJS app on ubuntu using Nginx and pm2, I typically add new text to my codebase. Here's the process I follow: git add . git commit -m 'new commit' git push After making changes, I navigate to my file directory in the cons ...

Avoid route misinterpretation by not adding parameters to the URL

Within my AngularJS application, I have implemented the following routing mechanism: $routeProvider.when('/questions', route.resolve('questions', 'questions/', ...