My config:
- Ubuntu 14.04
- Nginx 1.4.6
- PHP 5.5.9
- Moodle 3.0
I've completed the Moodle 3.0 installation through the browser and there is no css or javascript loaded. This is NGINX error log:
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"
2017/04/24 20:48:23 [error] 3277#0: *601 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:23 [error] 3277#0: *601 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *609 open() "/var/www/html/moodle/theme/styles.php/clean/1493057621/all" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/styles.php/clean/1493057621/all HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *611 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/javascript-static.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/javascript-static.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *611 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"
2017/04/24 20:48:24 [error] 3277#0: *606 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *606 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/javascript-static.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/javascript-static.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 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"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
It seems that the path is considering some .php files to be directories. This is my server config:
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 already tried these solutions:
Solution 1
Solution 2
They didn't work...
My config:
- Ubuntu 14.04
- Nginx 1.4.6
- PHP 5.5.9
- Moodle 3.0
I've completed the Moodle 3.0 installation through the browser and there is no css or javascript loaded. This is NGINX error log:
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"
2017/04/24 20:48:23 [error] 3277#0: *601 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:23 [error] 3277#0: *601 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *609 open() "/var/www/html/moodle/theme/styles.php/clean/1493057621/all" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/styles.php/clean/1493057621/all HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *611 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/javascript-static.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/javascript-static.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *611 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"
2017/04/24 20:48:24 [error] 3277#0: *606 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:24 [error] 3277#0: *606 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/javascript-static.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/javascript-static.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 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"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/lib/javascript.php/1493057621/lib/requirejs/require.min.js" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /lib/javascript.php/1493057621/lib/requirejs/require.min.js HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
2017/04/24 20:48:25 [error] 3277#0: *609 open() "/var/www/html/moodle/theme/javascript.php/clean/1493057621/footer" failed (20: Not a directory), client: 10.0.2.2, server: localhost, request: "GET /theme/javascript.php/clean/1493057621/footer HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/index.php"
It seems that the path is considering some .php files to be directories. This is my server config:
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 already tried these solutions:
Solution 1
Solution 2
They didn't work...
Share Improve this question edited May 23, 2017 at 12:09 CommunityBot 11 silver badge asked Apr 24, 2017 at 21:20 sergiomafrasergiomafra 1,5043 gold badges16 silver badges21 bronze badges 7 | Show 2 more comments2 Answers
Reset to default 12Please add below configuration code on your server part of nginx.conf file.
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;
}
Heres my plain nginx config which works fine for moodle >=3.1
server {
listen 80;
server_name someservername.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;
}
}
.php
scripts with pathinfo, but your configuration does not support pathinfo. See this recipe for guidance. – Richard Smith Commented Apr 24, 2017 at 21:51location ~ \.php$
statement only accepts URIs without pathinfo. The final$
means they finish after the.php
. That maybe all you need to change. – Richard Smith Commented Apr 25, 2017 at 8:34