As you know Debian 10 Buster is a warranty as an operating system on a server. Since the server is one of the main elements of a network, it is important that the system installed is efficient. In the same way, in this server, there could be many different applications and services. One of them is the GLPI this software that allows having controlled your computer park. In this post, you will learn how to install GLPI whit Nginx on Debian 10.
Install GLPI on Debian 10
First, connect to your server. To do this, connect to your server using the following command:
:~$ ssh [your-user]@[your-server]
Once you are on the server we can continue.
1.- Upgrade the system
Before starting any installation, it is recommended to upgrade the entire operating system. To do this you need to be a root user. If you do not have the password and your user can use sudo, you can do it like this.
:~$ sudo apt update && sudo apt upgrade
With this, the server will have installed all the security patches that have been published. This will make Debian 10 Buster more robust and stable.
2.- Install LEMP on Debian 10
Nginx has amazing results on performance issues. So in this case it will be chosen along with MariaDB and PHP. In short, we are talking about the LEMP stack.
To install it, I recommend you read our about it.
How to install LEMP on Debian 10?
Then, we can continue.
3) Preparing the system for GLPI
Before installing GLPI you need to install some PHP libraries first. This will make it run smoothly. It is likely that your system already has them installed but it is better to be sure of it.
:~$ sudo apt install php7.3 php7.3-curl php7.3-zip php7.3-gd php7.3-intl php-pear php-imagick php7.3-imap php-memcache php7.3-pspell php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-mbstring php-gettext php7.3-ldap php-cas php-apcu php7.3-mysql php7.3-fpm
These are all of them.
Then you have to configure a little PHP-FPM to make it compatible with Nginx.
Open the configuration file:
sudo nano /etc/php/7.3/fpm/pool.d/www.conf
And change these two lines of the file so that they look like this:
;listen = /var/run/php7-fpm.sock listen = 127.0.0.1:9000
Then save the changes by pressing CTRL + O and close it with CTRL + X.
Finally, apply the changes by restarting both services.
~$ sudo systemctl restart nginx php7.3-fpm
4) Creating the new database and user for GLPI
The next step is to create a new database for GLPI. We will do this from the MariaDB console.
Also, for security reasons, it is recommended to create a new user dedicated to that database. This way you will have a more orderly view of the MariaDB instance.
So, go to the MariaDB console:
:~$ sudo mysql -u root -p
And create the database and the user with their respective permissions.
> CREATE DATABASE glpidb; > GRANT ALL PRIVILEGES ON glpidb.* TO 'glpiuser'@'localhost' IDENTIFIED BY 'password'; > FLUSH PRIVILEGES; > exit;
Of course, you can modify the parameters to make it your own. Especially the password.
5) Install GLPI with Nginx on Debian 10 (I)
We now proceed to download and install GLPI. To do this we first navigate to the temporary folder and proceed to start the download with wget. At the time of writing this post, the last stable version is 9.4.4.
:~$ cd /tmp/ :~$ wget -c https://github.com/glpi-project/glpi/releases/download/9.4.4/glpi-9.4.4.tgz
Then, unzip the folder and assign the appropriate permissions to ensure the proper functioning of the application.
:~$ tar -xvf glpi-9.4.4.tgz :~$ sudo mv glpi /var/www/html/* :~$ sudo chmod 755 -R /var/www/html/* :~$ sudo chown $USER:$USER -R /var/www/html/*
The next step is to create a new Nginx configuration for GLPI. In this sense, it is convenient to make a new server block.
:~$ sudo nano /etc/nginx/sites-available/glpi
And add the following:
server { listen 80; server_name glpi.osradar.test; root /var/www/html/glpi; index index.php; location / {try_files $uri $uri/ index.php;} location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_param SERVER_NAME $host; } location ~ /files{ deny all; } }
Of course, you can replace the server_name by yours.
Then, enable the new configuration.
:~$ sudo ln -s /etc/nginx/sites-available/glpi /etc/nginx/sites-enabled/glpi.conf
Finally, restart both services:
:~$ sudo systemctl restart nginx php7.3-fpm
Now, we can continue the installation using the web browser.
6) Install GLPI with Nginx on Debian 10 (II)
Now, open your web browser and go to http://your-server and complete the installation. You will see the following:
So, choose your language and click OK.
Next, accept the license terms.
Once you have accepted them, you will see the following screen.
Once we have clicked on the install button. The wizard will determine the requirements of the application.
Now, enter MariaDB’s credentials.
Press the Continue button. Next, select the Database.
Then, initialize the database.
After this, you will have the option to collaborate with the project by sending anonymous statistics on the use of the application.
If everything went well, you will see the following screen with the contact credentials of the first users. Of course, you can change this later.
So, log in with the default credentials.
Finally, you will see the dashboard.
And that is it.
Conclusion
In this post, you have learned to install GLPI with Nginx on Debian 10. GLPI is an application to control the informatics equipment of your company. It is an administrative tool, more than anything. It is created in PHP and uses MariaDB as a database manager.
If you prefer Apache over Nginx you can read this post
How to install GLPI on Debian 10 Buster?
Please share this post with your friends. And join our Telegram channel.
Hi,
very nice tutorial, but I have question how you resolve this problem (from pic no 7.):
“Web access to files directory is protected
Web access to the files directory should not be allowed
Check the .htaccess file and the web server configuration.”
nginx not support .htaccess….
Check if you have Apache installed. If Apache is installed, remove it.
Thank you for the turorial and efforts!
I found that there is a backslash missing in the part:
The next step is to create a new Nginx configuration for GLPI. In this sense, it is convenient to make a new server block.
And add the following:
in the text you have
location ~ .php$ {
and in the picrture you have
location ~ \.php$ {
If users copy the text, it would be wrong
Post updated! Thanks
Secondly to avoid the error: Web access to the files directory should not be allowed
Add these lines to /etc/nginx/sites-available/glpi:
location ~ /files{
deny all;
}
It should look like this:
server {
listen 80;
server_name glpi.osradar.test;;
root /var/www/html/glpi;
index index.php;
location / {try_files $uri $uri/ index.php;}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param SERVER_NAME $host;
}
location ~ /files{
deny all;
}
}
Hello I am new to webserver. Whenever i want to access the page for glpi i get an error 502 bad gateway although i followed all instructions