cgi files in plain text

jeanjan nginx-forum at nginx.us
Wed May 11 01:59:41 MSD 2011


Hi,

I installed nginx and php5-fpm from repositories on ubuntu 10.04.
everything works well. The phpinfo test file works.

I try to access collection (for collectd) pages. When I access the url
of the collection3/bin/index.cgi, I can see the file in plain text.

This is the config file used :
server {
    listen   80;
    server_name  toto.com;
    access_log  /var/log/nginx/localhost.access.log;

## Default location
    location / {
        root   /var/www;
        index  index.php;
	try_files $uri $uri/ /index.php?q=$uri&$args;
	auth_basic            "Restricted";
	auth_basic_user_file  /var/htpasswd_au1;

    }

# Protection
#location = /var/www {
#  auth_basic            "Restricted";
#  auth_basic_user_file  /var/htpasswd_au1;
#}

##    try_files $uri $uri/ /index.php?q=$uri;
## Images and static content is treated different
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           30d;
      root /var/www;
    }



## Parse all .php file in the /var/www directory
    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
        include fastcgi_params;
        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_intercept_errors        on;
        fastcgi_ignore_client_abort     off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }

## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }
}
upstream backend {
        server 127.0.0.1:9000;
}

Thanks

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,197100,197100#msg-197100




More information about the nginx mailing list