Required package
Update the Ubuntu repository and install common packages:
$ sudo apt-get update $ sudo apt-get install curl git unzip mbstring
Install PHP7.4
It’s crucial to install 7.4, not 8.x
$ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get install php7.4 $ sudo apt-get install php7.4-fpm php7.4-pgsql php7.4-curl php7.4-cli php7.4-mbstring
Make sure that curl
, pgsql
and pdo_pgsql
extensions are installed
$ php -m
In case of any problems, try to remove php-common
and repeat the installation of modules
$ sudo apt-get --purge remove php-common
Install composer
$ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" $ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Install postgres
$ sudo apt-get install postgres
Configuring the database
$ sudo -u postgres psql -c "create database webclient;" $ sudo -u postgres psql -c "create user webclient;" $ sudo -u postgres psql -c "alter user webclient with encrypted password 'webclient';" $ sudo -u postgres psql -c "grant all privileges on database webclient to webclient;"
Install nginx
$ sudo apt-get install nginx
Insert or change the location section of the ngnix.conf file
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; }
Restart ngnix
$ sudo systemctl restart nginx
Copy and prepare the code
Copy the package to /var/www/html
Go to /api
folder and run composer
$ composer install
Prepare 3 config files and copy them to /api/conf.d
folder:
Initialize the database
Open this URL in your browser window
http://your_server_ip:port/api/v1/db/update
It should show something like this in the browser: