shavit
shavit

Reputation: 1063

nginx is downloading some files instead of executing them

For some reason, my nginx installation is running some .php files properly, while doesn't.

I have some files:

I have no idea what could cause this issue.

I tried:

Related nginx config part:

root /boot/www;

index index.html index.php;

server_name - my domain here -;

location / {
    try_files $uri $uri/ =404;
}

location /upload.php {
    include php5.conf;
}

location /asdfsda.php {
    include php5.conf;
}

location /popup.php {
    include php5.conf;
}

location /sig.php {
    include php5.conf;
}

php5.conf:

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

This issue started today, I didn't change anything in my config files recently.
It worked fine yesterday.

I'll appreciate any help, thanks!

UPDATE: If I change the name of asdfsda.php file that doesn't execute to something else, it actually does execute. For example, I renamed it to d.php and changed the config entry from asdfsda to d and it executed.
What is wrong?

Upvotes: 3

Views: 1769

Answers (1)

GerrSwin
GerrSwin

Reputation: 11

Why not use this?

location ~ ^/(upload|asdfsda|popup|sig)\.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    unix:/var/run/php5-fpm.sock;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         /etc/nginx/fastcgi_params;
}

Upvotes: 1

Related Questions