Cannot create directory alias (with php pages)

Nikolaos Milas nmilas at noa.gr
Thu Aug 14 13:04:47 UTC 2014


On 14/8/2014 3:26 μμ, Francis Daly wrote:

> The combination of a regex location, alias, and try_files, probably does
> not do what you want.
>
> I suspect that the 404-with-no-error-log comes from this try_files line.

Thank you very much Francis,

I removed the try_files line and did the modifications you suggest (esp. 
correction of the mistaken double inclusion of fastcgi_params you 
noticed), and indeed it works. (I have not tested requesting a PHP page 
with URL parameters yet.)

I have only decided to set:

    fastcgi_param SCRIPT_FILENAME $request_filename;

following a suggestion from here:

    http://blog.martinfjordvald.com/2011/01/no-input-file-specified-with-php-and-nginx/

rather than $document_root. Would you thing this setting is really 
preferable/correct in our case or not?

Here is current configuration:

     location ~ /xhprof(.+\.php)$ {

        alias /usr/share/xhprof/xhprof_html$1;

        allow 127.0.0.1;
        allow ::1;
        allow 10.10.10.0/24;
        deny all;

        fastcgi_cache off;

        include /etc/nginx/fastcgi_params;

        fastcgi_param PATH_INFO $fastcgi_script_name;

        fastcgi_intercept_errors on;

        fastcgi_buffer_size 384k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 384k;
        fastcgi_temp_file_write_size 384k;
        fastcgi_read_timeout 240;
        fastcgi_pass unix:/tmp/php-fpm.sock;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
     }

Thanks again,
Nick



More information about the nginx mailing list