# Cgi files in plain text

**URL:** <https://www.ruby-forum.com/t/cgi-files-in-plain-text/206811>\
**Category:** NGINX\
**Created:** [May 11, 2011, 12:00am UTC](https://www.ruby-forum.com/t/cgi-files-in-plain-text/206811 "2011-05-11T00:00:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 11, 2011, 12:00am UTC](https://www.ruby-forum.com/t/cgi-files-in-plain-text/206811/1 "2011-05-11T00:00:26Z")

</div>

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](http://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:

> **[cgi files in plain text](https://forum.nginx.org/read.php?2,197100,197100#msg-197100)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![jeanjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jeanjan](https://www.ruby-forum.com/u/jeanjan)\
**Post date:** [May 11, 2011, 1:08am UTC](https://www.ruby-forum.com/t/cgi-files-in-plain-text/206811/2 "2011-05-11T01:08:21Z")

</div>

## jeanjan Wrote:

> plain text.  
> root /var/www;
> 
> # auth\_basic\_user\_file /var/htpasswd\_au1;
> 
> ```
> fastcgi_param QUERY_STRING
> fastcgi_send_timeout 180;
> }
> 
> ```
> 
> }  
> upstream backend {  
> server 127.0.0.1:9000;  
> }
> 
> Thanks

You can either use a php-based web interface for collectd like  
php-collection or Collectd Graph Panel or if you need the ability to  
serve .cgi and .pl files (like for awstats) you’ll have to install  
another backend daemon.

You can use a light web server or I’d recommend fcgiwrap. A couple ppas  
have Lucid backports of the Ubuntu fcgiwrap package, (e.g.  
[https://launchpad.net/~wwu-numerik/+archive/lucid](https://launchpad.net/~wwu-numerik/+archive/lucid)).

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

---

<div class="post-metadata">

**Author:** ![jeanjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jeanjan](https://www.ruby-forum.com/u/jeanjan)\
**Post date:** [May 14, 2011, 2:20pm UTC](https://www.ruby-forum.com/t/cgi-files-in-plain-text/206811/3 "2011-05-14T14:20:21Z")

</div>

Thank you, I found out how to access collectd-web cause it has its own  
webserver.  
:s

Posted at Nginx Forum:

> **[Re: cgi files in plain text](https://forum.nginx.org/read.php?2,197100,197988#msg-197988)**
>
> 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...
