Welcome! Log In Create A New Profile

Advanced

location expression - PHP treated as binary file

September 24, 2012 11:04PM
Hi,

Having following configuration, PHP files, if requested from /junk or /pub locations, are treated as binary. Sample request - domain.com/pub/i.php -> file is downloaded to PC instead of executing.

Have no problems serving PHP files from other locations. Having separate locations for /pub /junk with autoindex also works, however my intention is to combine them in one expression.

upstream www-default {
server unix:/dev/shm/www-default.sock;
}

server {
listen 80;
server_name _;
index index.php index.html;
fastcgi_index index.php;
root /data/www/default/htdocs;
charset utf-8;
access_log /data/www/default/logs/frontend/access.log;
error_log /data/www/default/logs/frontend/error.log;
client_max_body_size 8m;

location ~* \.(jpg|jpeg|gif|css|png|js|swf|ico)$ {
expires max;
}

location / {
try_files $uri $uri/ /index.html;
}

location ~ (/\.svn|/\.ht) {
deny all;
}

location ~* ^/(pub/|junk/) {
autoindex on;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass www-default;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include /etc/nginx/fastcgi_params;
}
}
Subject Author Posted

location expression - PHP treated as binary file

technoplague September 24, 2012 11:04PM

Re: location expression - PHP treated as binary file

Edho Arief September 24, 2012 11:26PM

Re: location expression - PHP treated as binary file

technoplague September 25, 2012 12:03AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 59
Record Number of Users: 6 on August 08, 2016
Record Number of Guests: 386 on August 02, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready