# Images Aren't Displaying When Perl Interpreter Is Enabled

**URL:** <https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544>\
**Category:** NGINX\
**Created:** [January 16, 2014, 8:47am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544 "2014-01-16T08:47:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 16, 2014, 8:47am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/1 "2014-01-16T08:47:53Z")

</div>

I have awstats set up and working with Nginx and perl but all images  
return  
a 404 error. The virtual host config is identical to other websites  
where  
images work fine except for the added part for perl.

I think i know what’s happening but i dont know how to fix it; images  
are  
being sent to the perl interpreter instead of Nginx. Here’s my config:

server {  
listen 1.2.3.4:80;  
server\_name [stats.example.com](http://stats.example.com);  
rewrite ^ https://$server\_name$request\_uri? permanent;  
}

server {  
listen 1.2.3.4:443;  
server\_name [stats.example.com](http://stats.example.com);

access\_log /path/to/logs/stats/access.log;

```
error_log /path/to/logs/stats/error.log;

index awstats.pl index.html index.htm;
client_max_body_size 40M;

ssl on;
ssl_certificate /etc/nginx/ssl/ssl.crt;
ssl_certificate_key /etc/nginx/ssl/private.key;

location / {
root /path/to/the/awstats/wwwr;
index index.html index.htm;
try_files $uri $uri/ /index.html?$uri&$args;
auth_basic "Restricted";
auth_basic_user_file /path/to/the/awstats/htpasswd;
}

# Block Image Hotlinking
location /icon/ {
valid_referers none blocked stats.example.com;
if ($invalid_referer) {
return 403;
}
}

# Dynamic stats.
location ~ \.pl$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8999;
fastcgi_index index.pl;
fastcgi_param SCRIPT_FILENAME

```

/path/to/the/awstats/wwwroot/$fastcgi\_script\_name;  
}  
}

Posted at Nginx Forum:

> **[Images Aren't Displaying When Perl Interpreter Is Enabled](https://forum.nginx.org/read.php?2,246500,246500#msg-246500)**
>
> I have awstats set up and working with Nginx and perl but all images return a 404 error. The virtual host config is identical to other websites where images work fine except for the added part for perl. I think i know what's happening but i dont know...

---

<div class="post-metadata">

**Author:** ![MasterMind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MasterMind](https://www.ruby-forum.com/u/MasterMind)\
**Post date:** [January 16, 2014, 10:12am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/2 "2014-01-16T10:12:31Z")

</div>

At first, pre-coffee glance, I suspect people will be better placed to  
help you if you provide some examples (redacted if necessary) of URIs  
that work and URIs that don’t work …

---

<div class="post-metadata">

**Author:** ![MasterMind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MasterMind](https://www.ruby-forum.com/u/MasterMind)\
**Post date:** [January 24, 2014, 5:34am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/3 "2014-01-24T05:34:48Z")

</div>

That’s not really possible since the awstats is password protected. But  
find below an image of what im seeing and an image of what it should  
look  
like:

Broken:  
[https://dl.dropboxusercontent.com/u/18722727/awstats.png](https://dl.dropboxusercontent.com/u/18722727/awstats.png)

What it should look like:  
[https://dl.dropboxusercontent.com/u/18722727/awstats2.png](https://dl.dropboxusercontent.com/u/18722727/awstats2.png)

Posted at Nginx Forum:

> **[Re: Images Aren't Displaying When Perl Interpreter Is Enabled](https://forum.nginx.org/read.php?2,246500,246769#msg-246769)**
>
> I have awstats set up and working with Nginx and perl but all images return a 404 error. The virtual host config is identical to other websites where images work fine except for the added part for perl. I think i know what's happening but i dont know...

---

<div class="post-metadata">

**Author:** ![MasterMind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MasterMind](https://www.ruby-forum.com/u/MasterMind)\
**Post date:** [January 24, 2014, 5:45am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/4 "2014-01-24T05:45:49Z")

</div>

I removed the block referrer images section and index line from the  
config  
because i thought that might be causing it and it didnt fix it, but it  
did  
change the error message logs are showing (i have no idea how to fix  
this):

2014/01/23 23:39:07 [error] 5372#0: \*31 rewrite or internal redirection  
cycle while internally redirecting to “/index.html”, client: x.x.x.x,  
server: [xx.firedaemon.com](http://xx.firedaemon.com), request: “GET /icon/other/vv.png HTTP/1.1”,  
host:  
“[xx.firedaemon.com](http://xx.firedaemon.com)”, referrer:  
“[https://xx.firedaemon.com/awstats.pl?config=forums.firedaemon.com&framename=mainright](https://xx.firedaemon.com/awstats.pl?config=forums.firedaemon.com&framename=mainright)”

Posted at Nginx Forum:

> **[Re: Images Aren't Displaying When Perl Interpreter Is Enabled](https://forum.nginx.org/read.php?2,246500,246771#msg-246771)**
>
> I have awstats set up and working with Nginx and perl but all images return a 404 error. The virtual host config is identical to other websites where images work fine except for the added part for perl. I think i know what's happening but i dont know...

---

<div class="post-metadata">

**Author:** ![MasterMind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MasterMind](https://www.ruby-forum.com/u/MasterMind)\
**Post date:** [February 12, 2014, 6:12am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/5 "2014-02-12T06:12:07Z")

</div>

Oops :X

[https://stats.site.com/icon/other/vv.png](https://stats.site.com/icon/other/vv.png)

# Block Image Hotlinking

location /icon/ {  
valid\_referers none blocked [stats.site.com](http://stats.site.com);  
if ($invalid\_referer) {  
return 403;  
}

I thought maybe the image hotlinking part broke it, so i removed it and  
images still dont display. I just tried copying an image to the root  
directory and image still doesnt display.

Posted at Nginx Forum:

> **[Re: Images Aren't Displaying When Perl Interpreter Is Enabled](https://forum.nginx.org/read.php?2,246500,247440#msg-247440)**
>
> I have awstats set up and working with Nginx and perl but all images return a 404 error. The virtual host config is identical to other websites where images work fine except for the added part for perl. I think i know what's happening but i dont know...

---

<div class="post-metadata">

**Author:** ![MasterMind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@MasterMind](https://www.ruby-forum.com/u/MasterMind)\
**Post date:** [January 24, 2014, 9:59am UTC](https://www.ruby-forum.com/t/images-arent-displaying-when-perl-interpreter-is-enabled/238544/6 "2014-01-24T09:59:39Z")

</div>

On Thu, Jan 23, 2014 at 11:33:56PM -0500, MasterMind wrote:

Hi there,

> That’s not really possible since the awstats is password protected.

I think the question wasn’t intended to be “can I have access to your  
private site”, but was rather “what is the url of an image request which  
does not respond the way you want it to”.

Your config has three location blocks:

location / {  
location /icon/ {  
location ~ .pl$ {

Which one is used for the image request?

Which one do you want to be used for the image request?

And, which file on the filesystem corresponds to the image you are  
requesting?

## f

Francis D. removed\_email\_address@domain.invalid
