Error "File not found." in wordpress using nginx

  fpm, linux, nginx, php, wordpress

I have configured a WordPress blog in a separate directory named example-blog. I would like to display the blog when user visits https://example.com/blog. However, with the below config, I’m getting an error "File not found." when I try to visit the blog in the browser window. The example-blog directory has a permission of 755.

location ^~ /blog {
        alias /var/www/html/example-blog;
        index index.php index.html index.htm;
        try_files $uri $uri/ /blog/index.php?$args;

        location ~ .php$ {
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }

Source: Ask PHP

LEAVE A COMMENT