mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
The nginx sidecar's static location (`location ~* \.(css|js|...)$`) ended in `try_files $uri =404`. Moodle 5.3 serves its ES modules from `/core/esm/<rev>/...` through r.php, and those paths do not exist on disk. Regex locations win over `location /`, so every module URL ending in `.js` (`bootstrap/bootstrap.js`, `@moodlehq/design-system/theme-boost/index.js`, ...) got nginx's own 404 and never reached PHP; both are preloaded on every page. Fall back to `/r.php` like `location /` does. Files that exist on disk are still served directly with their cache headers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
47 lines
1.4 KiB
Django/Jinja
47 lines
1.4 KiB
Django/Jinja
# Moodle nginx vhost. Mounted into the nginx sidecar at
|
|
# /etc/nginx/conf.d/default.conf. Implements Moodle's official
|
|
# nginx recipe (https://docs.moodle.org/en/Nginx).
|
|
|
|
server {
|
|
listen {{ MOODLE_NGINX_PORT }};
|
|
listen [::]:{{ MOODLE_NGINX_PORT }};
|
|
|
|
server_name _;
|
|
root {{ MOODLE_PUBLIC_DIR }};
|
|
index index.php;
|
|
|
|
client_max_body_size 256M;
|
|
|
|
{{ NETWORK_DOCKER_DNS_NGINX_DIRECTIVE }}
|
|
set $moodle_upstream {{ MOODLE_CONTAINER }};
|
|
|
|
location / {
|
|
try_files $uri $uri/ /r.php$is_args$args;
|
|
}
|
|
|
|
location ~ [^/]\.php(/|$) {
|
|
fastcgi_split_path_info ^(.+\.php)(/.*)?$;
|
|
set $path_info $fastcgi_path_info;
|
|
try_files $fastcgi_script_name $fastcgi_script_name/ /r.php$is_args$args;
|
|
fastcgi_index index.php;
|
|
fastcgi_pass $moodle_upstream:{{ MOODLE_FPM_PORT }};
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
|
fastcgi_param PATH_INFO $path_info;
|
|
fastcgi_param HTTP_PROXY "";
|
|
fastcgi_read_timeout 300;
|
|
}
|
|
|
|
location ^~ /moodledata/ {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
|
|
location ~* \.(css|js|gif|jpe?g|png|webp|svg|ico|woff2?|ttf)$ {
|
|
expires 1d;
|
|
add_header Cache-Control "public";
|
|
try_files $uri /r.php$is_args$args;
|
|
}
|
|
}
|