.htaccess: how to restrict access to a single file by IP?

This will allow either someone from IP 127.0.0.1 or logged as a valid user. Stick it either in your config or .htaccess file. <Files learn.php> Satisfy any Order deny,allow Deny from all Allow from 127.0.0.1 AuthType Basic AuthName “private” AuthUserFile /var/www/phpexperts.pro/.htpasswd AuthGroupFile /dev/null Require valid-user </Files> IP Alone: <Files learn.php> Order deny,allow Deny from all … Read more

Setting up Git Server on Windows With git-http-backend.exe

OK, so hell has frozen over and I have finally got this working! I believe there were two things that were fundamentally wrong with my setup. 1) The user was not getting authentication passed through, I found this helped: SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER Secondly I couldn’t get the physical “Directory” to work. <Directory “C:/GIT/Apache/repositories”> Options +ExecCGI AuthType … Read more

How do I configure Apache2 to allow multiple simultaneous connections from same IP address?

I discovered the answer to my problem. It turns out others have encountered this difficulty before: Simultaneous Requests to PHP Script The key detail is that file-based sessions in PHP cause all requests from the same client to be processed sequentially in a queue, rather than in parallel. In order to solve this problem, it … Read more

OpenSSL not working on Windows, errors 0x02001003 0x2006D080 0x0E064002

The code below works as expected. BUT if you run openssl_error_string() after the openssl methods it shows error:0E06D06C:configuration file routines:NCONF_get_string:no value which is some notice I have not been able to find documentation on. Further note that according to http://www.php.net/manual/en/function.openssl-error-string.php you could be seeing mis-leading errors as error messages are queued: Be careful when using … Read more

Make .git directory web inaccessible

Put this in an .htaccess file at the root of your web server: RedirectMatch 404 /\.git This solution is robust and secure: it works for all .git directories in your site, even if there are more than one, also hides other Git files like .gitignore and .gitmodules works even for newly-added .git directories, and doesn’t … Read more