Re: [bitfolk] Restricting access to a .php file on Debian St…

Top Page
Author: Andy Smith
Date:  
To: users
Subject: Re: [bitfolk] Restricting access to a .php file on Debian Stretch with Apache 2.4 and php7-fpm

Reply to this message
gpg: Signature made Sun Apr 15 03:23:30 2018 UTC
gpg: using DSA key 2099B64CBF15490B
gpg: Good signature from "Andy Smith <andy@strugglers.net>" [unknown]
gpg: aka "Andrew James Smith <andy@strugglers.net>" [unknown]
gpg: aka "Andy Smith (UKUUG) <andy.smith@ukuug.org>" [unknown]
gpg: aka "Andy Smith (BitFolk Ltd.) <andy@bitfolk.com>" [unknown]
gpg: aka "Andy Smith (Linux User Groups UK) <andy@lug.org.uk>" [unknown]
gpg: aka "Andy Smith (Cernio Technology Cooperative) <andy.smith@cernio.com>" [unknown]
Hello,

On Sat, Apr 14, 2018 at 09:37:53PM +0100, Ian wrote:
> * Before (Jessie):


[…]

> <Files "wp-login.php">
> AuthName "Message that Firefox shows but Chromium no longer does!"
> AuthType Basic
> AuthUserFile /home/exampleuser/.htpasswd
> Require valid-user
> </Files>


[…]

> * After (Stretch):
>
> Because of the changes between the two, Apache now calls php-fpm via the
> proxy-fcgi module in /etc/apache2/sites-available/example.com.conf -
>
> ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php7.0-fpm_exampleuser.sock|fcgi://localhost/home/exampleuser/public_html/
>
> and with the same .htaccess file, it *doesn't* trigger on access to
> wp-login.php because it's a .php file, ProxyPass gets there first and just
> runs it without checking anywhere else if it should.


What happens if you put the wp-login stuff in a
<Location></Location> instead? And do it without .htaccess at first
until you get it working…

The basic point here I think is that if you are proxying everything
then it's no longer a file so <Files> is never going to match.

Cheers,
Andy

--
https://bitfolk.com/ -- No-nonsense VPS hosting