Cannot create directory alias (with php pages)
    Nikolaos Milas 
    nmilas at noa.gr
       
    Thu Aug 14 11:06:38 UTC 2014
    
    
  
On 13/8/2014 11:42 μμ, Nikolaos Milas wrote:
> Now, I want to create an /xhprof location, which includes php code and 
> lives in another disk path (in: /usr/share/xhprof/xhprof_html). I 
> can't make this work...
I have modified configuration as follows; the /xprof location works 
(i.e. I can access non php files), but all php files cannot be accessed 
(message: 404 Not Found). Nothing is recorded in the error log.
Why can't I access the php files in /usr/share/xhprof/xhprof_htmlas 
/xhprof/filename.php ?
Please advise!
------------------------------------------------------------------------------------------
server {
     listen [::]:80;
     server_name  piwik.example.com;
     access_log  /var/webs/wwwpiwik/log/access_log main;
     error_log /var/webs/wwwpiwik/log/error_log warn;
     root   /var/webs/wwwpiwik/www/;
     index  index.php index.html index.htm index.cgi default.html 
default.htm default.php;
     location / {
        try_files $uri $uri/ /index.php?$args;
        allow 127.0.0.1;
        allow ::1;
        allow 10.10.10.0/24;
        deny all;
     }
     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;
        try_files $uri =404;
        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;
         include /etc/nginx/fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $document_root$1;
     }
     location ~ /xhprof(.*) {
         alias /usr/share/xhprof/xhprof_html$1;
         allow 127.0.0.1;
         allow ::1;
         allow 10.10.10.0/24;
         deny all;
     }
     location ~ \.php$ {
        allow 127.0.0.1;
        allow ::1;
        allow 10.10.10.0/24;
        deny all;
        fastcgi_cache off;
        try_files $uri =404;
        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;
         include /etc/nginx/fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     }
}
------------------------------------------------------------------------------------------
Thanks,
Nick
    
    
More information about the nginx
mailing list