Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

SNIPE-IT Installation on Ubuntu Server (NGINX)

SNIPE-IT Installation on Ubuntu Server (NGINX)

In this blog post, we will look at SNIPE-IT installation on Ubuntu Server with NGINX web server.

Last updated on 9th of March 2021

Check-out step-by-step video demonstration of SNIPE-IT installation.

Requirements for this guide to follow

  1. Ubuntu server up and running
  2. Static IP assigned to the server
  3. Internet connectivity
  4. Logged in with user account created during Ubuntu server installation or Root user (logging in as root not recommended)

1. Connect to Ubuntu server

Highly recommend to use a SSH client for connectivity and it will make easy to copy/paste commands as compare to directly interacting with your Ubuntu server console.
I will be using Putty as SSH client. Here is the direct link to download Putty or you could use your preferred SSH client.

OpenSSH server status/installation

  • OpenSSH is already installed. You can check SSH server status
sudo service ssh status

  • If Open SSH server is not installed, you can install it by using the following commands:
sudo apt install OpenSSH-Server
  • Verify Open SSH server status
sudo service ssh status

  • Open SSH server’s configuration file is located here, file name is sshd_config. Open SSH should work out of the box, however, you can edit it if needed with your preferred choice of editor
cd /etc/ssh

2. Update/Upgrade installed packages

Update and upgrade installed packages on Ubuntu server. You will need to run this command as sudo and enter ‘y’ when prompted to confirm.

sudo apt update && sudo apt upgrade

3. Install NGINX, MySQL, PHP and PHP FPM

  1. Install NGINX
    sudo apt install nginx
  2. Install MySQL
    sudo apt install mysql-server
  3. Install PHP and PHP-FPM
    sudo add-apt-repository universe
    sudo apt install php-fpm php-mysql

Check versions

  • MySQL server version
    sudo mysql -V
  • NGINX version
    sudo nginx -V
  • PHP Version
    sudo php --version

 Test Installation

  • NGINX: Browse to IP address of your server and you should see NGINX generic web page

  • MySQL: Run the following command to see the status of MySQL Server
    sudo service mysql status

4. Create a new site and test PHP

In this step, we will create a new site for Snipe-IT, disable default site and test php. Also, we will restart the relevant services. We will come back to this later and update the root folder once SNIPE-IT is downloaded.

  • Create new site with name, you can update this name if you like to something else
    sudo nano /etc/nginx/sites-available/
  • Add site content as follows, update Directory if you download Snipe-IT in a different folder and Server Name to your Ubuntu Server’s IP address
    server {
        listen 80;
        listen [::]:80;
        root   /var/www/html;
        index  index.php index.html index.htm;
        access_log /var/log/nginx/;
        error_log /var/log/nginx/;
        location / {
        try_files $uri $uri/ /index.php$is_args$args;
        location ~ \.php$ {
             include snippets/fastcgi-php.conf;
             fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
             include fastcgi_params;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             fastcgi_intercept_errors on;
Line numberConfigUpdate
5server_nameEnter your server’s IP Address/Host Name
9access_logUpdate name of your website
10error_logUpdate name of your website
20location ~ \.php$Update PHP-FPM version in fastcgi_pass

Easiest way to check PHP-FPM version is by typing the following in the terminal and hit tab. This should populate the value as shown below. For instance if your PHP-FPM version is 7.4 then enter the value as php7.4-fpm.


  • Enable new site
    sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
  • Disable default site
    sudo unlink /etc/nginx/sites-enabled/default
  • Restart Nginx
    sudo service nginx restart
  • PHP: Create a simple PHP page and browse to IP_Address/phpinfo.php
    sudo bash -c "echo -e '<?php\nphpinfo();\n?>' > /var/www/html/phpinfo.php"

Do not proceed further if PHP is not working

5. Download Snipe-IT

Clone recent version of Snipe-IT from GIT into a local folder snipeit.

  • Working directory is /var/www
    cd /var/www/
  • Clone Snipe-IT to local folder snipeit
    sudo git clone snipeit
  • Make a copy of .env environmental file
    cd /var/www/snipeit
    sudo cp .env.example .env
  • If you like, you can have a quick look inside the .env file with nano editor. We will come back to this file later on. Don’t make any changes to the file and use Ctrl + X to exit
    sudo nano .env

6. Configure MySQL Server

Run MySQL secure installation command line wizard and secure the installation.

sudo mysql_secure_installation
  • yes or no, if you would like to install Validate Password Plugin (I selected no for this in my lab environment)
  • The next part offers you to change the password for the root of MySQL and enter password twice
  • The next option to remove anonymous users, I will choose Yes 
  • The next option to stop root login remotely, I would go for no 
  • Reload privileges table: Yes 
  • You will see, “All done”, once it is all done 

7. Create an initial database and a user

In this step, we will create database, user and grant specific privileges to new user.

  • Login to MySQL server, provide password for MySQL root user when it prompts
    sudo mysql -u root -p
  • Create new database snipeit_db
    CREATE DATABASE snipeit_db;
  • Create new user snipeit_user
    CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'password'; 
  • Grant permissions to sipeit_user on database snipeit_db
    GRANT ALL PRIVILEGES ON snipeit_db.* TO 'snipeit_user'@'localhost';
  • Verify permissions
    Show GRANTS FOR 'snipeit_user'@'localhost'; 

  • Flush privileges
    flush privileges;
  • Quit
  • Restart MySQL service
    sudo service mysql restart
  • Check MySQL service status
    sudo service mysql status

8. Update .env file

Let’s update .env file with the required information. 

cd /var/www/snipeit
sudo nano .env

Update the following:

  • App_URL

9. Update folder permissions

Update folder permissions in the Snipe-IT root directory

  • Working directory is /var/www/snipeit
    cd /var/www/snipeit
  • Update permissions
    sudo chown -R www-data:www-data /var/www/snipeit/
    sudo chmod -R 755 storage
    sudo chmod -R 755 public/uploads

10. Download Composer

Working directory is logged in user’s home directory. In my case it is /home/snipeit

sudo curl -sS | php
sudo mv composer.phar /usr/local/bin/composer

11. Install PHP dependencies

There are a number of PHP dependencies, ensure these all are successfully installed. 
Working directory: Home directory of logged in user 

sudo add-apt-repository universe
sudo apt-get install -y git unzip php php-curl php-mysql php-gd php-ldap php-zip php-mbstring php-xml php-bcmath php-tokenizer

12. Install Composer

Working directory: /var/www/snipeit

cd /var/www/snipeit
sudo composer install --no-dev --prefer-source

13. Generate App Key for .env file

Run the following command and enter yes when prompted

sudo php artisan key:generate

Verify the key generation

Open .env file and check APP_KEY value

sudo nano .env

14. Update Snipe-IT site

We created a site earlier and in this step we will update the root folder.

sudo nano /etc/nginx/sites-available/

Update the root to the following:


Restart the web server

sudo service nginx restart

15. Snipe-IT pre-flight setup

Browse to IP address of your Ubuntu server and you should see the pre-flight page. Follow the prompts and you are done!!

Your feedback is important for us and other users. Leave it in the comments how did you go with your setup 🙂

About Jay Singh

Follow Me
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
8 months ago

hi i have a problem SQLSTATE[42S21]

Would love your thoughts, please comment.x