Homestead VM 上的 Moodle 安装错误

Moodle installation error on Homestead VM

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

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

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

我附上了几张截图。

非常感谢,迈克。

好的,经过几天的摸索,我通过编辑 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)(/)(.*)$ /?file=/ 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;
    }
}

我还没来得及看上面配置中哪个part/parts解决了这个问题,也许知道的人可以直接看到?我怀疑这可能是重写规则?无论哪种方式,我都希望这对将来的其他人有所帮助,我真的很高兴能做到这一点!

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

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