Unexpected token in json at position 0 là gì năm 2024

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Error

Reverse proxy enabled so the server cannot be accessed directly. Please contact the server administrator.

config.php

// Hostname definition //

$hostname = 'cmli.seaversity.com.ph';

if ($hostname == '') {

$hostwithprotocol = 'https://loadbalancer';

}

else {

$hostwithprotocol = 'https://' . strtolower($hostname);

}

$CFG->wwwroot = strtolower($hostwithprotocol);

$CFG->sslproxy = (substr($hostwithprotocol,0,5)=='https' ? true : false);

$CFG->reverseproxy = true;

Webserver (backend)

server {

listen 80;

listen [::]:80;

server_name moodle.link;

set $base /var/www/moodle;

# security

include nginxconfig.io/security-moodle.conf;

# logging

error_log /var/log/nginx/cmli.seaversity.com.ph.error.log warn;

# index.php

index index.php;

location / {

root $base/html;

index index.php;

try_files $uri $uri/ /index.php?$query_string;

}

# additional config

include nginxconfig.io/general-moodle.conf;

location ~ ^(.+\.php)(.*)$ {

root $base/html;

fastcgi_split_path_info ^(.+\.php)(.*)$;

fastcgi_index index.php;

fastcgi_pass unix:/run/php-fpm/www.sock;

include mime.types;

include fastcgi_params;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_read_timeout 1000;

client_max_body_size 3072M;

client_body_buffer_size 10M;

}

}

webserver nginx (proxy)

server {

listen 443 ssl http2;

listen [::]:443 ssl http2;

server_name moodle.link;

# SSL

ssl_certificate /etc/letsencrypt/live/moodle.link/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/moodle.link/privkey.pem;

ssl_trusted_certificate /etc/letsencrypt/live/moodle.link/chain.pem;

# logging

error_log /var/log/nginx/moodle.link.error.log warn;

add_header Access-Control-Allow-Origin *;

location / {

# include default.d/pagespeed.conf;

# include nginxconfig.io/general-moodle.conf;

proxy_pass http://backend;

proxy_http_version 1.1;

proxy_cache_bypass $http_upgrade;

# Proxy headers

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "upgrade";

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-Port $server_port;

# Proxy timeouts

proxy_connect_timeout 60s;

proxy_send_timeout 60s;

proxy_read_timeout 1000s;

This is your settings not working too

# proxy_set_header Host $http_host;

# proxy_set_header X-Forwarded-Host $host:$server_port;

# proxy_set_header X-Forwarded-Server $host;

# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# proxy_read_timeout 1000s;

# proxy_redirect default;

}

}