Nginx subfolder for news/blog

Hey

I’m trying to run GRAV in a subfolder of my main website in a different root folder. So far I get only File not found. by visting my site under https://my.site/news/.

My nginx code for GRAV is:

# GRAV
    location ^~ /news {
        alias /srv/http/grav/;
        index index.php index.html index.htm;

        rewrite ^/news/(.*)+$ /news/index.php?$1;
        try_files $uri $uri/ /news/index.php?$query_string;

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

What am I missing here?

@Dans, Have you tried the docs? Change the site URL | Grav Documentation

At the moment I’m just trying to install it. But I’ll probably need the link later as well.
I just can’t get through to the installation. Just File not found. So problem on nginx config?

Anyway, I also tried a few things from the link you have posted, but exactly the same problem.

Ok. I found the issue. I just forgot to add my php config file include php.conf;.
Whole subfolder config is now:

# GRAV
    location ^~ /news {
        alias /srv/http/grav/;
        index index.php index.html index.htm;

        if (!-e $request_filename) { rewrite ^ /news/index.php last; }
        try_files $uri $uri/ /news/index.php?$query_string;

        ## Begin - Security
        # deny all direct access for these folders
        location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
        # deny running scripts inside core system folders
        location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
        # deny running scripts inside user folder
        location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
        # deny access to specific files in the root folder
        location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }
        ## End - Security

        if ($request_method !~ ^(GET|HEAD|POST)$ ) {
           return 405;
        }

        location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|webp|woff2)$ {
           expires 2d;
           add_header Cache-Control "public, no-transform, max-age=31536000";
        }

        access_log /var/log/nginx/grav_access.log;
        error_log /var/log/nginx/grav-error.log;

        include php.conf;
    }

If someone need it.