Install Opencart 4 on NGINX
In order to install Opencart 4 you must have php 8.0+ installed
Also in the php.ini file you need to uncomment the following modules
extension=curl.so;
extension=gd.so;
extension=zip.so;
Note: If you don't have them on your system, install them. Replace the numbers 8.3 with your php version
apt-get install -y php8.3-curl php8.3-gd php8.3-zip
Restart PHP-FPM
systemctl restart php8.3-fpm
I want my site opencart4.com to be in a folder var/www/
Сreate a opencart4.com folder
mkdir /var/www/opencart4.com
Set folder permissions 755
chmod 755 /var/www/opencart4.com
Download Opencart 4
Unzip the archive and copy the contents of the upload folder to the opencart4.com folder
Rename config-dist.php to config.php and /admin/config-dist.php to /admin/config.php
Set folders and files permissions
Set permissions 777 for the cache directories
chmod 777 /var/www/opencart4.com/image/cache/
chmod 777 /var/www/opencart4.com/system/storage/cache/
And files config.php and /admin/config.php
chmod 777 /var/www/opencart4.com/config.php
chmod 777 /var/www/opencart4.com/admin/config.php
Now open our website in the browser
http://localhost/opencart4.com/
You must agree to the license agreement. Click Continue.
Pre-Installation page. Click Continue.

Configuration page

Click Continue.
Don't forget to delete your installation directory!
rm -r /var/www/opencart4.com/install
Now open the file default.conf
nano /etc/nginx/conf.d/default.conf
And write to it
server {
listen 80;
server_name opencart4.com;
root /var/www/$server_name/;
error_log /var/log/nginx/opencart4.com.error.log;
location / {
try_files $uri $uri/ /index.php?q=$uri$args;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $uri =404;
include fastcgi_params;
}
}
Restart NGINX
service nginx restart
How to fully configure the NGINX server is described in this article