'Error when trying to open chamilo using LEMP on Centos7

I have been trying to set up Chamilo using LEMP stack (Linux, Nginx, MariaDB, PHP 7) on CentOS 7 using this link https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7 as guide. It was working on nginx default page and php.info but not when i tried to set up chamilo. my chamilo block server config is in /etc/nginx/conf.d/default.conf i replaced nginx default into chamilo using redirection rule below. also i tried this site : https://wiki.crowncloud.net/?How_to_Install_Chamilo_with_LEMP_Stack_on_Rocky_Linux_8 and modify it to be used in centos7 and still couldnt find solution.

  server {
        listen 80;
        listen [::]:80;
        root /var/www/html/chamilo;
        index index.php index.html index.htm;
        server_name  192.xxx.xxx.xxx;
    
      charset utf-8;
    
      location @rewrite{
        rewrite ^certificates/$ certificates/index.php last;
        rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last;
        rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last;
        rewrite ^/courses/([^/]+)/scorm/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/scorm/$2 last;
        rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
        # Alternatively, you can choose to give direct access to all SCORM files, which is much faster but less secure
        # rewrite "^/courses/([^/]+)/scorm/(.*)$" /app/courses/$1/scorm/$2 break;
    
        rewrite "^/courses/([^/]+)/document/certificates/(.*)$" /app/courses/$1/document/certificates/$2 last;
        rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
        rewrite ^/courses/([^/]+)/upload/([^/]+)/(.*)$ /main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 last;
        rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
        rewrite ^/courses/([^/]+)/upload/course_home_icons/(.*([\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/upload/course_home_icons/$2 last;
        rewrite ^/courses/([^/]+)/(.*)$ /app/courses/$1/$2 last;
        rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last;
        rewrite ^/course/([^/]+)/about/?$ /main/course_info/about.php?course_id=$1 last;
        rewrite ^/badge/(\d+) /main/badge/issued.php?issue=$1 last;
        rewrite ^/skill/(\d+)/user/(\d+)$ /main/badge/issued_all.php?skill=$1&user=$2 last;
        rewrite ^/badge/(\d+)/user/(\d+)$ /main/badge/issued_all.php?skill=$1&user=$2 last;
        rewrite ^/main/exercice/(.*)$ /main/exercise/$1 last;
        rewrite ^/main/newscorm/(.*)$ /main/lp/$1 last;
        rewrite ^/service/(\d+)$ /plugin/buycourses/src/service_information.php?service_id=$1 last;
        rewrite "^/main/upload/users/(.*)/(.*)/my_files/(.*)$" /app/upload/users/$1/$2/my_files/$3 last;
    
        try_files $uri /index.php$is_args$args;
        break;
      }
    
      location / {
        try_files $uri @rewrite;
      }
    
      location /main {
        rewrite ^/main/admin/?$ /main/admin/index.php last;
      }
    
      location ~ \.php$ {
        client_max_body_size 20M;
        try_files $uri @rewrite;
    
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
      }
    
      # Serve static files directly
      location ~* \.(png|jpe?g|gif|ico|js|css|mp3|swf|flv|mp4|ogg|woff|woff2)$ {
        rewrite ^/courses/([^/]+)/course-pic85x85.png$ /app/courses/$1/course-pic85x85.png last;
        rewrite ^/courses/([^/]+)/course-pic.png$ /app/courses/$1/course-pic.png last;
        rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
        rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
        rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
        rewrite ^/courses/([^/]+)/upload/(.*)$ /app/courses/$1/upload/$2 last;
        # For all these media resources not treated by previous rewrites, give direct access (no permission check)
        rewrite ^/courses/(.*)$ /app/courses/$1 break;
        expires 30d;
        access_log off;
        try_files $uri @rewrite;
      }
    
      location ~ ~\.(ht|git){
        deny all;
      }
      location ^~ /tests/ {
        deny all;
      }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source