Images Aren't Displaying When Perl Interpreter Is Enabled

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;
rewrite ^ https://$server_name$request_uri? permanent;
}

server {
listen 1.2.3.4:443;
server_name 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:

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 …

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

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

Posted at Nginx Forum:

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, request: “GET /icon/other/vv.png HTTP/1.1”,
host:
xx.firedaemon.com”, referrer:
https://xx.firedaemon.com/awstats.pl?config=forums.firedaemon.com&framename=mainright

Posted at Nginx Forum:

Oops :X

https://stats.site.com/icon/other/vv.png

Block Image Hotlinking

location /icon/ {
valid_referers none blocked 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:

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. [email protected]