
發生的情況是 GLPI 專案未載入檔案(js、css、php 等)。
本機 URL 是http://localhost/glpi-grupo/
,但是 Elements 中的所有檔案都遺失了,如下/glpi-grupo
所示:http://localhost/style.css
我需要強制它們載入子目錄/glpi-grupo
我正在使用 Nginx 和 Traefik,它們都在 Docker 容器中。
我的 traefik 規則:
traefik.frontend.rule: Host:localhost; PathPrefixStrip:/glpi-grupo
我的 Nginx 設定:
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SERVER_NAME $host;
fastcgi_index index.php;
fastcgi_pass glpi-grupo:9000;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}