【问题标题】:Moodle installation error on Homestead VMHomestead VM 上的 Moodle 安装错误
【发布时间】:2015-11-15 13:20:53
【问题描述】:

我已经在我的 Mac (OSX Yosemite) 上安装了 Homestead VM 并设置了 Moodle 安装文件夹。我还创建了“moodledata”文件夹,并通过我的系统命令行为其授予权限 0777 以及文件夹“moodledata/sessions”(我尝试通过 VM 内的 SSH 执行此操作,但似乎没有更改权限) .但是,通过我的系统检查权限后显示该文件夹可从 VM 内部写入。

然后我继续安装,它运行并创建了数据库表并进行了检查,显示 2 个检查警告: Intl 和 xmlrpc 来检查

我不认为这些对于初始安装如此进行是必不可少的。当我创建管理员用户时,我遇到了问题。页面 (/user/editadvanced.php?id=2) 停止加载任何图像,当我发布表单时出现错误:“提交的 sesskey 不正确,表单不被接受!” 我认为这可能是由于会话在 moodledata 文件夹中不可写,但我已经检查过,现在我没有想法了!

我附上了几张截图。

非常感谢,迈克。

【问题讨论】:

    标签: php nginx moodle homestead


    【解决方案1】:

    好吧,经过几天的头疼后,我通过编辑 NGINX 配置文件解决了我自己的问题。以下是默认情况:

    server {
        listen 80;
        server_name example.com;
        root /home/forge/example.com;
    
        # FORGE SSL (DO NOT REMOVE!)
        # ssl_certificate;
        # ssl_certificate_key;
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/example.com-error.log error;
    
        error_page 404 /index.php;
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    

    这就是我把它改成的,现在它可以工作了:

    server {
        listen 80;
        server_name example.com; #REPLACE SERVER NAME
    
        root /var/www/example.com/www/; #REPLACE MOODLE INSTALL PATH
        error_log /var/www/example.com/log/example.com_errors.log; #REPLACE MOODLE ERROR LOG PATH
        access_log /var/www/example.com/log/example.com_access.log; #REPLACE MOODLE ACCESS LOG PATH
    
        rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
    
        location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php;
        }
    
        fastcgi_intercept_errors on;
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
    
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    

    我还没有时间查看上述配置的哪些部分/部分解决了问题,也许知道的人可以立即看到?我怀疑这可能是重写规则?无论哪种方式,我都希望这对其他人有所帮助,我真的很高兴能够让它发挥作用!

    【讨论】:

    • 经过进一步调查,它只是这一行:rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
    • Moodle 现在有一个特定的 nginx 配置页面:moodle nginx page
    【解决方案2】:

    我可以确认只是该特定配置文件的重写部分,尽管在 Moodle Nginx 页面中没有这样记录。

    我的猜测是 location ~ [^/]\.php(/|$) { 部分与重写规则 rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;location ~ \.php$ { 指令做同样的事情。需要进行一些测试来更改位置指令,看看是否也能正常工作。

    【讨论】:

    • 好吧,我可以确认如果没有重写规则这是行不通的,那么:为什么 Moodle 没有记录它?还是我们做错了什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-03
    • 1970-01-01
    相关资源
    最近更新 更多