Skip to content

Tag: Apache

Using ‘Require expr’ in Apache: Cannot parse expression in require line: syntax error, unexpected $end

We found that if you do what the Apache documentation says and put quotes around the expr: Require user victron Require expr "%{REQUEST_URI} =~ m#^/.well-known/acme-challenge/.*#" Read More »

NFSN PHP file write permissions in safe_mode

I've been causing some (security) concerns for myself by thoughtlessly using the dreaded 777 permissions for upload directories to allow the various PHP-based websites that I host at nearlyfreespeech.net to write files there. What this drastic anti-security measure didn't allow me to is to manage these uploaded files through SSH (and SCP/Rsync). In the chroot jail which I'm allowed to enter through SSH, I am ‘me’, while the files created from PHP end up being owned by user ‘web’. However, for some reason these files didn't get owned by group ‘web’ of which the ‘me’ user is a member. Also, I got into trouble with new directories that were being created by the upload scripts. Read More »

Apache mod_proxy configuration for The Pirate Bay

I found several apache mod_proxy configs for setting up a proxy for The Pirate Bay, but none worked fully. Read More »

Safari: don’t give gzipped content a .gz extension

Yesterday, while helping Caloe with the website for her company De Buitenkok, I came across the mother of all stupid bugs in Safari. Me having recently announced payformystay.com, I loaded it up in Apple's hipster browser only to notice that the CSS wasn't loaded. Oops! Read More »

Allowing apache to set Nagios cmd file

On debian, to prevent: Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’! Read More »

Apache rewrite rule to rewrite to sub dir

One one particular site, I wanted to rewrite all requests to a sub dir. It took me over an hour, because of some obscure problem I haven't been able to identify. Read More »

Rewrite rules to redirect to a temporary offline page

Sometimes you want to take a site offline for a while. You can put this in .htaccess or the vhost config: Read More »

Preventing IOerror on stdout with modWSGI

By default, you can't use prints in a django app, because mod_wsgi restricts that. You can change that by putting this in your configuration: Read More »

Changing an apache virtual host to ssl

To change a virtual host in apache to ssl: #Redirect all normal traffic to the https site. RewriteEngine on RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [L,R] Read More »

Redirect multiple domains to one

When a site is available under multiple domains, it is usually bad idea to not have them all redirect to one domain. In apache, do this: Read More »