php not working from aliased subdir

Nikolaos Milas nmilas at noa.gr
Wed Feb 1 16:53:23 UTC 2017


On 31/1/2017 10:13 μμ, Francis Daly wrote:

> Replace the line with
>
>      fastcgi_param SCRIPT_FILENAME $request_filename;

Thank you Francis.

Your suggestion has indeed solved the issue!

You rock!

> Comparehttp://nginx.org/r/$fastcgi_script_name  with
> http://nginx.org/r/$request_filename  to see why you probably want the
> latter in each case you use "alias".

I still have a long way to go until I feel confident with nginx 
configuration, I am afraid...

Unfortunately, we are one of those one-man-shops, where we cannot devote 
sufficient time in learning all technologies we deal with in the 
required depth.

That's why we need to disturb from time to time polite people like you. :-)

By the way, is there some method to define a block of code which can be 
included at various places?

For example, we might have a block like:

         location ~ \.php$ {

            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_param QUERY_STRING    $query_string;
            fastcgi_param REQUEST_METHOD  $request_method;
            fastcgi_param CONTENT_TYPE    $content_type;
            fastcgi_param CONTENT_LENGTH  $content_length;

            fastcgi_pass unix:/tmp/php-fpm.sock;
            fastcgi_index index.php;

            include /etc/nginx/fastcgi_params;

         }

Can we define it as a block and include it where needed as a reference?

Again, thanks a lot!
Nick


More information about the nginx mailing list