要求¶
GLPI 是一款Web应用程序它需要:
web服务器;
PHP;
一个数据库.
Web 服务器¶
GLPI 要求Web服务器能支持 PHP, 例如:
Apache configuration¶
Here is a virtual host configuration example for Apache 2 web server.
警告
The following configuration is only suitable for GLPI version 10.0.7 or later.
<VirtualHost *:80>
ServerName glpi.localhost
DocumentRoot /var/www/glpi/public
# If you want to place GLPI in a subfolder of your site (e.g. your virtual host is serving multiple applications),
# you can use an Alias directive. If you do this, the DocumentRoot directive MUST NOT target the GLPI directory itself.
# DocumentRoot /var/www/html
# Alias "/glpi" "/var/www/glpi/public"
<Directory /var/www/glpi/public>
Require all granted
RewriteEngine On
# Ensure authorization headers are passed to PHP.
# Some Apache configurations may filter them and break usage of API, CalDAV, ...
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect all requests to GLPI router, unless file exists.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
</VirtualHost>
备注
If you cannot add specific rewrite rules to the Apache configuration (e.g. you are using a shared hosting), you can use a .htaccess file.
Still, you need to define the DocumentRoot to be the /public directory of GLPI.
# /var/www/glpi/public/.htaccess
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
Nginx configuration¶
Here is a configuration example for Nginx web server using php-fpm.
警告
The following configuration is only suitable for GLPI version 10.0.7 or later.
server {
listen 80;
listen [::]:80;
server_name glpi.localhost;
root /var/www/glpi/public;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php$ {
# the following line needs to be adapted, as it changes depending on OS distributions and PHP versions
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
lighttpd configuration¶
Here is a virtual host configuration example for lighttpd web server.
警告
The following configuration is only suitable for GLPI version 10.0.7 or later.
$HTTP["host"] =~ "glpi.localhost" {
server.document-root = "/var/www/glpi/public/"
url.rewrite-if-not-file = ( "" => "/index.php${url.path}${qsa}" )
}
IIS configuration¶
Here is a web.config configuration file example for Microsoft IIS.
The physical path of GLPI web site must point to the public directory of GLPI (e.g. D:\glpi\public), and the web.config file must be placed inside this directory.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to GLPI" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
警告
The URL Rewrite module is required.
PHP¶
GLPI version |
Minimum PHP version |
|---|---|
10.0.X |
7.4 |
11.0.X |
8.2 |
备注
GLPI compatibility with new PHP versions is validated shortly after their release. We therefore recommend using the most recent version, for better performances.
必备扩展依赖¶
应用需要以下PHP扩展才能正常工作:
dom,fileinfo,filter,libxml,simplexml,tokenizer,xmlreader,xmlwriter: these PHP extensions are enable by default and are used for various operations;curl: used for remote access to resources (inventory agent requests, marketplace, RSS feeds, ...);gd: used for images handling;intl: used for internationalization;mysqli: used for database connection;session: used for sessions support;zlib: used for handling of compressed communication with inventory agents, installation of gzip packages from marketplace and PDF generation.
For GLPI 11.0, these additional PHP extensions are mandatory:
bcmath: used for QRCodes generation;mbstring: used for multibyte chars support and charset conversion;openssl: used for handling of encrypted communication with inventory agents and OAuth 2.0 authentication.
可选的扩展¶
备注
即使这些扩展不是强制性的,我们建议您无论如何都要安装它们。
对于GLPI的一些额外特性,需要以下PHP扩展:
bz2,Phar,zip: enable support of most common packages formats in marketplace;exif: enhance security on images validation;ldap: enable usage of authentication through remote LDAP server;openssl: enable email sending using SSL/TLS;Zend OPcache: enhance PHP engine performances.
Following PHP extensions are emulated in GLPI and can be enabled to slightly improve performances:
* ctype;
* iconv;
* sodium.
Security configuration for sessions¶
To enhance security, it is recommended to configure PHP sessions with the following settings:
session.cookie_secure: should be set toonwhen GLPI can be accessed on only HTTPS protocol;session.cookie_httponly: should be set toonto prevent client-side scripts from accessing cookie values;session.cookie_samesite: should be set, at least, toLax, to prevent cookies from being sent cross-origin (across domains) POST requests.
备注
Refer to PHP documentation for more information about session configuration.
数据库¶
为了工作,GLPI需要一个数据库服务器。
GLPI version |
Database server |
Minimum version |
|---|---|---|
10.0.X |
MySQL |
5.7 |
10.0.X |
MariaDB |
10.2 |
11.0.X |
MySQL |
8.0 |
11.0.X |
MariaDB |
10.6 |
备注
GLPI compatibility with new LTS database servers versions is validated shortly after their release. We therefore recommend using a recent version, for better performances.