Aller au contenu

GLPI

MariaDB

Installation

Bash
apk add mariadb mariadb-client

Configuration

Bash
1
2
3
4
mysql_install_db --user=mysql --datadir=/var/lib/mysql
rc-service mariadb start
rc-update add mariadb
mysql_secure_installation

Base de données GLPI

Bash
mysql -u root -p

⚠ CHANGER LE MOT DE PASSE CI-DESSOUS

Text Only
1
2
3
4
5
CREATE USER 'glpi'@'localhost' IDENTIFIED BY '';
CREATE DATABASE IF NOT EXISTS glpi CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON glpi.* TO 'glpi'@'localhost';
FLUSH PRIVILEGES;
QUIT;

PHP

Installation

Bash
apk add php82-bz2 php82-curl php82-dom php82-exif php82-fileinfo php82-gd php82-intl php82-mysqli php82-opcache php82-openssl php82-phar php82-session php82-simplexml php82-xml php82-xmlreader php82-xmlwriter php82-zip php82-ldap php82-ctype php82-iconv php82-sodium php82-fpm

Configuration

date.timezone

Bash
sed -i.bak 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php82/php.ini

memory_limit

Bash
sed -i.bak 's/memory_limit = 128M/memory_limit = 1024M /g' /etc/php82/php.ini

session.cookie_httponly

Bash
sed -i.bak 's/session.cookie_httponly =/session.cookie_httponly = on/g' /etc/php82/php.ini

PHP-fpm

Lancer le service

Bash
rc-service php-fpm82 start
rc-update add php-fpm82

GLPI

Installation

Bash
1
2
3
4
cd /tmp
wget https://github.com/glpi-project/glpi/releases/download/10.0.9/glpi-10.0.9.tgz
tar zxvf ./glpi-10.0.9.tgz
rm ./glpi-10.0.9.tgz

Configuration

config

Bash
mv ./glpi/config /etc/glpi
nano /etc/glpi/local_define.php
PHP
1
2
3
<?php
define('GLPI_VAR_DIR', '/var/lib/glpi');
define('GLPI_LOG_DIR', '/var/log/glpi');
Bash
chown nobody:nobody -R /etc/glpi

files

Bash
mv ./glpi/files /var/lib/glpi
chown nobody:nobody -R /var/lib/glpi

log

Bash
mkdir /var/log/glpi
chown nobody:nobody -R /var/log/glpi

downstream

Bash
nano ./glpi/inc/downstream.php
PHP
1
2
3
4
5
<?php
define('GLPI_CONFIG_DIR', '/etc/glpi/');
if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
require_once GLPI_CONFIG_DIR . '/local_define.php';
}

GLPI

Bash
1
2
3
4
mkdir /usr/share/webapps
mv ./glpi /usr/share/webapps/glpi
chown nobody:nobody -R /usr/share/webapps/glpi
cd

Nginx

Installation

Bash
apk add nginx

Configuration

nginx.conf

Bash
mv /etc/nginx/nginx.conf /etc/nginx/[old]-nginx.conf
nano /etc/nginx/nginx.conf
Text Only
user nginx;
worker_processes auto;

# Configures default error logger.
error_log /var/log/nginx/error.log warn; # Log warn, error, crit, alert, emerg

events {
    # The maximum number of simultaneous connections that can be opened by a worker process.
    worker_connections 1024; # increase if you need more connections
}

http {
    # server_names_hash_bucket_size controls the maximum length
    # of a virtual host entry (ie the length of the domain name).
    server_names_hash_bucket_size   64; # controls the maximum length of a virtual host entry (ie domain name)
    server_tokens                   off; # hide who we are, don't show nginx version to clients
    sendfile                        off; # can cause issues

    # nginx will find this file in the config directory set at nginx build time
    # Includes mapping of file name extensions to MIME types of responses
    include mime.types;

    # fallback in case we can't determine a type
    default_type application/octet-stream;

    # buffering causes issues, disable it
    # increase buffer size. still useful even when buffering is off
    proxy_buffering off;
    proxy_buffer_size 4k;

    # allow the server to close the connection after a client stops responding. Frees up socket-associated memory.
    reset_timedout_connection on;

    # Specifies the main log format.
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
            '$status $body_bytes_sent "$http_referer" '
            '"$http_user_agent" "$http_x_forwarded_for"';

    # Sets the path, format, and configuration for a buffered log write.
    # Buffer log writes to speed up IO, or disable them altogether
    access_log /var/log/nginx/access.log main buffer=16k;
    #access_log off;

    # Include files with config snippets into the root context.
    include conf.d/*.conf;

    # Includes virtual hosts configs.
    include http.d/*.conf;
}

glpi.conf

Bash
mv /etc/nginx/http.d/default.conf /etc/nginx/http.d/default.conf.old
nano /etc/nginx/http.d/glpi.conf
Text Only
server {
    listen 80;
    listen [::]:80;

    #server_name glpi.localhost;

    root /usr/share/webapps/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-fpm82/php-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;

        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Démarrer le service

Bash
rc-service nginx start
rc-update add nginx

test avec nobody