Config nginx server and php for new domain

Hello
i’m new here. Thank you for the great forum. I readed a lot of posts, but i can’t fix my problem

I used apache since a few years. now ii want to change to nginx, because i need to reinstall my full system and i would like to change to nginx since a few weeks.

I set up it, but i can’t request to the link.
I need to access my datas by this url: 10.0.0.myipadress/terminal/index.php

i can’t setup it right…

my workaround:

sudo mkdir /var/www/terminal
sudo nano /etc/nginx/sites-available/terminal
sudo ln -s /etc/nginx/sites-available/terminal /etc/nginx/sites-enabled/
server {
    listen 80;
    listen [::]:80;

    root /var/www/terminal;
    index index.php index.html index.htm;

    server_name terminal;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    }
}

but when i go to 10.0.0.142/terminal/i can’t open any sites

As you made /var/www/terminal the root, your site is accessible via yourIP/index.php or just yourIP (as index.php is one of the default indexes). If you want to access through the subdir, change the document root to /var/www.

However, /var/www is the default document root, so this would not require any additional vhost but /etc/nginx/sites-enabled/default only. Also, your vhost contains an ancient PHP-FPM handler. PHP 7.0 was last used on Debian Stretch, while our current images ship with Debian Bookworm, 3 generations newer, where PHP 8.2 is used. Check out our default vhost about this as well, or simply use the default vhost instead of an own one.