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

Jump to

Quick reference

Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts

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


Nginx high-performance webserver

Nginx is a high-performance HTTP server. http://wiki.nginx.org/Main

Seems to be used by quite a lot of sites and a few people have noticed nginx 404 error pages by facebook and youtube indicating they may also be using it? http://wiki.nginx.org/NginxWhyUseIt

Comes also with a memcached module to talk with memcached directly: http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/

And has embedded perl in it as standard: http://wiki.nginx.org/NginxEmbeddedPerlModule

And call perl directly from SSI
<!- # perl sub="module::function" arg="parameter1" arg="parameter2"... >

For XSLT fans: http://wiki.nginx.org/NginxHttpXsltModule