0

I'm trying to run a moodle application along with nginx but when I access the domain it returns 403. I've already changed the folder's permissions, the index.php file exists.

Log Nginx:

*306 directory index of "/var/www/html/moodle/" is forbidden

File config nginx:

    server {
    #access_log logs/yourwebsite.com-access_log;
    #error_log logs/yourwebsite.com-error_log crit;
    server_name estudar.cresceredu.com.br www.estudar.cresceredu.com.br;
    index index.php index.html index.htm; # index defined to be served under directory
    root /var/www/html/moodle/; # default directory where the files will be stored and served from

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

    location / {
        #root /var/www/html/moodle;
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
        # moodle rewrite rules
       # rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;
    }


    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

            # With php5-cgi alone:
#            fastcgi_pass 127.0.0.1:9000;
            # With php5-fpm:
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

}

1 Answers1

0

Please check if NGINX needs a specific right to do this. Had the same problem one time also. Fix for me was to set the folder group/user to a other user. For me the solution was the user and group: www-data www-data

this can be done with the following command: sudo chown -R www-data:www-data /var/www/html/moodle/

I hope this will fix it for you !

rikkamp
  • 38
  • 4