Can not use local domain with NGINX


I deleted the docker environment and using now Pihole, NGINX and PHP via the software center installation.

Now again I wanted to use a local domain with NGINX. But it does not work for me.

I wanna use Grav CMS for a local website. I followed the tutorial on a german website:

Everything worked fine until I used the domain, which was used in the conf file (/etc/nginx/conf.d/grav.conf):

server {

listen 80;

root /var/www/html/grav;

index index.html index.php;

location / {
   try_files $uri $uri/ /index.php?$query_string;

   location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
   location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
   location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
   location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }

location ~ \.php$ {
   fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   fastcgi_index index.php;
   include fastcgi_params;
   fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;


The NGINX installation was very new via the software center.

What can I do?

maybe a conflicting configuration. Do you still have the default config file in place?

cat /etc/nginx/sites-enabled/default

cat /etc/nginx/sites-enabled/default
#D I E T - P I
# /etc/nginx/sites-available/default

server {

        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www;
        index index.php index.html index.htm index.nginx-debian.html;

        server_name "$hostname";

        include /etc/nginx/sites-dietpi/*.conf;

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

        location ~ \.php(?:$|/) {
                include snippets/fastcgi-php.conf;
                fastcgi_pass php;


basically you have a similar configuration in 2 different files. I would recommend to place all your stuf into a single file to avoid duplicate and conflicting entries.

Probably best to use /etc/nginx/sites-enabled/default and to adjust to your needs

Do you mean that I should change the default conf file and use this instead if grav.conf file?

At least you would need to decide which one to keep as both files contains the same parameters, just with different values.