Welcome! Log In Create A New Profile

Advanced

Re: PHP files being downloaded on condition

August 02, 2011 02:26AM
On Tue, Aug 02, 2011 at 01:35:41AM -0400, Samael wrote:
> Hello, guys,
>
> Another Apache convert here. My 3rd day with nginx and loving it.
>
> I have a nginx + php-fpm setup. The problem is that nginx downloads the
> PHP scripts without being parsed instead of passing them to php-fpm - so
> far I have discovered that happening only with Chrome's 14.0.835
> (64bit), otherwise it works just fine; there is no difference whether
> php-fpm is running or not, so I think it is safe to assume that the
> scripts are not being passed to the backend at all. The relevant
> (hopefuly configuration):
>
>
> location ~ \/[0-9a-zA-Z]+\.php$ {
> try_files $uri =404;
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> include fastcgi_params;
> fastcgi_index index.php;
> fastcgi_param PATH_INFO $fastcgi_path_info;
> fastcgi_param PATH_TRANSLATED
> $document_root$fastcgi_script_name;
> fastcgi_param SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
> fastcgi_intercept_errors on;
> if ($uri ~*
> \/(images?|system|download|upload|cache|logs?)\/(.*\/)?[0-9a-z]+\.php$)
> {
> return 404;
> }
> fastcgi_pass php-fpm;
> }
>
> location /url/ {
> alias /dir/url/;
> index index.php;
>
> if ($request_uri ~* \.(ico|css|js|gif|jpe?g|png)$) {
> expires 30d;
> break;
> }
> if (-f $request_filename) {
> break;
> }}
>
> Any ideas? How can I prevent such things from happening, providing some
> failsafe, disallowing php files' download? I have so far come out with
> that, protecting only possible configuration files:
>
> location ~ (/\.|.*conf.*\.php) {
> deny all;
> }
>
> But I would like a more generic approach, if possible.

Your .htaccess style configuration is not easy to understand.
Could you describe in words what you want to get ?


--
Igor Sysoev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

PHP files being downloaded on condition

Samael August 02, 2011 01:35AM

Re: PHP files being downloaded on condition

Igor Sysoev August 02, 2011 02:26AM

Re: PHP files being downloaded on condition

Edho Arief August 02, 2011 02:28AM

Re: PHP files being downloaded on condition

Samael August 02, 2011 03:28AM

Re: PHP files being downloaded on condition

Igor Sysoev August 03, 2011 03:34PM

Re: PHP files being downloaded on condition

Samael August 04, 2011 04:33AM

Re: PHP files being downloaded on condition

Igor Sysoev August 04, 2011 06:28AM

Re: PHP files being downloaded on condition

Samael August 12, 2011 02:28PM

Re: PHP files being downloaded on condition

Igor Sysoev August 13, 2011 06:26PM

Re: PHP files being downloaded on condition

Samael August 14, 2011 12:25AM

Re: PHP files being downloaded on condition

Sharl.Jimh.Tsin August 14, 2011 02:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 263
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready