NGINX: reverse proxy

Let's say you want to access a transmission instance via torrent.yourdomain.com, you need this configuration inside the server block:

location / {
   proxy_pass http://localhost:9091;
}

NGINX: IP address filtering

IP filtering is written inside the server block.

If for example you want to protect yourdomain.com/files, you need to write this:

location /files {
   allow 1.2.3.4;
   deny all;
}

With this, only the 1.2.3.4 network will be able to access yourdomain.com/files.

FIREFOX: updating/removing 301's cache

If you already had the issue, you know it's a pain in the ass.

Testing some http/https redirections, and Firefox cached the 301, and keeps using them.

To stop it from doing that, you need to go to about:config, and search for browser.cache.check_doc_frequency.

Once you found it, change its value to "1", refresh the page w/ which you had the problem, check it doesn't happen anymore, and changed the value back to 3 (its default value).

LIGHTTPD: restricting access

$HTTP["remoteip"] !~ "1.2.3.4|9.8.7.6" {
        $HTTP["url"] =~ "" {
        url.access-deny = ( "" )
        }
}

You need to put it in the lighttpd's host block, so that only 1.2.3.4 and 9.8.7.6 can access it.

LIGHTTPD: reverse proxy

$HTTP["host"] == "yourdomain.com" {
     proxy.server = ( "" => (("host" => "yourip", "port" => 8080 )))
 }

So when you visit yourdomain.com, you'll be redirected on whatever is on the port 8080 of yourip.

FIREFOX: removing tooltips

To remove tooltips ("mouseover popups) in firerox, you just need to switch browser.chrome.toolbar_tips from true to false.

GIT: cgit automatic repo creation

Here's the function (use it as it is or as a script, doesn't matter):


function create_git_repo() {
if [ -z "$1" ]
then
    echo "'/!\' You need a repo name '/!\'"
else
wd=$(pwd)
mkdir ~/$1.git
cd ~/$1.git && git init --bare
echo -e "\nrepo.url=$1
repo.path=/home/git/$1.git
repo.desc=$1 stuff
repo.owner=youruser" >> /etc/cgitrc
echo 'repo.clone-url=git@yoururl:~/$CGIT_REPO_URL.git' >> /etc/cgitrc
cd $wd
fi
}

You'll need to do the first push with git push -u origin master.

It's needed to check if an argument is given, because if a repo with no name is created, cgit will segfault when we want to check any repo.