A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

nginx basics

How to serve up a directory on the web

  • sudo apt-get install nginx
  • vi /etc/nginx/nginx.conf # observe how the html { } section has: include /etc/nginx/sites-enabled/*;
  • vi /etc/nginx/sites-available/foo # build the server { } section


server {
    listen 80 default_server;
    root /var/www/html/foo;
    index index.html
    location / {
        autoindex on;
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/.htpasswd;
    }
}


  • # build .htpasswd file
  • ln -s /etc/nginx/sites-available/foo /etc/nginx/sites-enabled/foo
  • service nginx restart


Easy/Hard vs Complex/Simple

This may help estimating your stories in agile:

Easy Hard
Simple Washing car Pushing car
Complex Driving car Building car

How to do authentication with Mojolicious

It's like this:


401 vs 403 HTTP codes

Explanation:

401 'Unauthorized' should actually be 401 'Unauthenticated'
It should be used for missing or bad authentication.

403 'Forbidden' is the server telling you, "I know who you are, and you don't have permission to access this resource".

(source)