Moodle:安装期间出错

Moodle:安装期间出错

我正在尝试安装 Moodle,一切似乎都很好,但当涉及到管理员用户创建过程时,似乎没有 CSS 文件,并且“更新个人资料”按钮不执行任何操作。所以我卡在了页面上moodle/user/editadvanced.php?id=2

我还附上了该网站的截图。

我已经尝试了所有可能的方法,例如将权限更改为 777,或者使用 root 用户、Nginx 用户和该目录的所有者。但每次安装后情况都一样。

我已经搜索过这个问题,但找不到解决方案。我正在按照教程如何锻造安装 Moodle。

截屏

我的 moodle 数据位置: /var/moodledata

我的 Moodle 目录: /var/www/career/moodle/

我的 Nginx 配置文件:

    server {
    listen 80;
    listen   443 ssl spdy;
    server_name  domain.com;
    keepalive_timeout    70;
    root   /var/www/domain;

    #ssl  on;
    gzip    on;
    ssl_certificate  /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key  /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
    ssl_protocols   TLSv1.2;
    ssl_ciphers     EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:!3DES;
    ssl_dhparam     /etc/nginx/conf.d/dhparam.pem;
    ssl_prefer_server_ciphers   on;
    ssl_session_tickets     off;
    ssl_session_cache       shared:SSL:10m;

          add_header   Strict-Transport-Security "max-age=63072000; includeSubdomains; ";
    add_header   X-Frame-Options "DENY";
    spdy_headers_comp 6;
    spdy_keepalive_timeout 300;

    access_log  /var/log/nginx/career.access.log;
    error_log   /var/log/nginx/career.error.log;

    location / {
            root   /var/www/career;
            #try_files $uri $uri/ = /404.html;
            if ($request_uri ~ ^/(.*)\.html$) {  return 302 /$1;  }
            try_files $uri $uri/ $uri.html $uri.php?$args;
            index  index.php index.html;
            add_header   Strict-Transport-Security "max-age=63072000; includeSubdomains" always;
    }

    error_page  404  /404.html;
    location = /404.html {
            root    /var/www/career;
            internal;
    }

    error_page  405  /405.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
            root   /var/www/career;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~* \.php$ {
            root           /var/www/career;
            #fastcgi_pass   127.0.0.1:9000;
            fastcgi_pass php-fpm;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME         $document_root$fastcgi_script_name;
            include  fastcgi_params;
            #if ($request_uri ~ ^/([^?]*)\.php($|\?)) {  return 302 /$1;  }
            try_files $uri = 404;
            fastcgi_split_path_info  ^(.+\.php)(/.+)$;
            fastcgi_param QUERY_STRING  $query_string;
            fastcgi_param REQUEST_METHOD  $request_method;
            fastcgi_param CONTENT_TYPE  $content_type;
            fastcgi_param CONTENT_LENGTH  $content_length;
            fastcgi_intercept_errors  on;
            fastcgi_ignore_client_abort  off;
            fastcgi_connect_timeout  60;
            fastcgi_send_timeout  180;
            fastcgi_read_timeout  180;
            fastcgi_buffers 256  16k;
            fastcgi_buffer_size  32k;
            fastcgi_temp_file_write_size  256k;

    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
            deny  all;
    }

    }

尝试过的 Moodle 版本:3.5.1 和 3.2.9

数据库创建步骤:

  1. CREATE DATABASE DATABASENAME DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

  2. GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON DATABASENAME.* TO 'DB_USER'@'localhost' IDENTIFIED BY 'PASSWORD';

Mysql版本:5.5.56-MariaDB MariaDB 服务器

我个人认为是权限问题,出于某种原因,Moodle 可能无法访问文件或安装它。但即使我给了moodledatadir 和moodledir 777 权限。

更新

我发现有些文件未加载且丢失,如下图所示。

日志中的 JavaScript 文件错误

资源中的 PHP 文件错误

答案1

我替换了location .phpnginx.conf 文件中的,现在它可以正常工作了。并且斜线参数现在工作正常。

新的location

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

相关内容