How to install and use djbdns name server on Ubuntu 6.06 LTS

I do not issue any guarantee that this will work for you!!!
btw. it’s working for me :p

apt-get install build-essential

Download patches:

mkdir -p /usr/local/djb/patches
cd /usr/local/djb/patches
wget http://www.thedjbway.org/patches/djb_errno_patches.tgz
tar xfvz djb_errno_patches.tgz

Install daemontools:

mkdir -p /package
chmod 1755 /package
cd /package
wget  http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
gunzip daemontools-0.76.tar
tar -xpf daemontools-0.76.tar
rm daemontools-0.76.tar
cd admin/daemontools-0.76
touch /etc/inittab
patch -p1 < /usr/local/djb/patches/daemontools-0.76.errno.patch
package/install

Install ucspi-tcp:
Download the ucspi-tcp package to a temporary directory (example: /usr/src)

cd /usr/src
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
tar xfvz ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch -p1 < /usr/local/djb/patches/ucspi-tcp-0.88.errno.patch
make
make setup check

Install djbdns:
Download the djbdns package to a temporary directory (example: /usr/src)

cd /usr/src
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
gunzip djbdns-1.05.tar.gz
tar -xf djbdns-1.05.tar
cd djbdns-1.05
echo gcc -O2 -include /usr/include/errno.h > conf-cc
make
make setup check

Configuring name server:
Make sure you replace 1.2.3.4 with the external IP address of your system…

useradd tinydns
useradd dnslog
tinydns-conf tinydns dnslog /etc/tinydns 1.2.3.4
ln -s /etc/tinydns /service 

useradd dnscache
dnscache-conf dnscache dnslog /etc/dnscache 127.0.0.1
ln -s /etc/dnscache /service

To use dnscache, replace the existing name servers in /etc/resolv.conf with 127.0.0.1, the IP address that dnscache is listening on…

cp /etc/resolv.conf /etc/resolv.conf.backup
nano /etc/resolv.conf

Replace content of resolv.conf with:

nameserver 127.0.0.1

For tinydns web based front end you can use vegadns.. For how to set up vegadns go to http://www.djbdnsrocks.org/single/vegadns.htm


DW Alliance / Dalbjerg / TechKey

Nginx rewrite config for ArticleLive

Nginx rewrite rules for ArticleLive:

if (!-e $request_filename) {
rewrite  ^/categories(.*)$  /categories.php?$1  last;
rewrite  ^/articles(.*)$  /articles.php?$1  last;
rewrite  ^/pages(.*)$  /pages.php?$1  last;
rewrite  ^/blogs(.*)$  /blogs.php?$1  last;
rewrite  ^/news(.*)$  /news.php?$1  last;
rewrite  ^/authors(.*)$  /authors.php?$1  last;
rewrite  ^/search(.*)$  /search.php?$1  last;
rewrite  ^/articlerss(.*)$  /articlerss.php?$1  last;
rewrite  ^/contact(.*)$  /contact.php?$1  last;
rewrite  ^/blogrss(.*)$  /blogrss.php?$1  last;
rewrite  ^/newsrss(.*)$  /newsrss.php?$1  last;
break;
}

Running XtraUpload Under Nginx

Nginx rewrite rules for XtraUpload:

if (!-e $request_filename) {
# New Rewrite Rules for total site SEO
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/index\.htm$ /$1.php?$2=$3&$4=$5&$6=$7&$8=$9&$10=$11 last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/index\.htm$ /$1.php?$2=$3&$4=$5&$6=$7&$8=$9 last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/index\.htm$ /$1.php?$2=$3&$4=$5$6=$7& last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/index\.htm$ /$1.php?$2=$3&$4=$5 last;
rewrite ^/(.*)/(.*)_(.*)/index\.htm$ /$1.php?$2=$3 last;

# More New Rewrite Rules for total site SEO, with index.htm pagess at the end
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/$ /$1.php?$2=$3&$4=$5&$6=$7&$8=$9&$10=$11 last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/$ /$1.php?$2=$3&$4=$5&$6=$7&$8=$9 last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/(.*)_(.*)/$ /$1.php?$2=$3&$4=$5$6=$7& last;
rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*)/$ /$1.php?$2=$3&$4=$5 last;
rewrite ^/(.*)/(.*)_(.*)/$ /$1.php?$2=$3 last;

# Old rewrite rules for Files
rewrite ^/file/(.*)/(.*)$ /index.php?p=download&link=$1&name=$2 last;
rewrite ^/files/(.*)/(.*)$ /index.php?p=download&link=$1&name=$2 last;
rewrite ^/files/(.*)$ /index.php?p=download&hash=$1 last;
rewrite ^/download/(.*)$ /index.php?p=get&file=$1 last;

# Old Rewrite rules for direct imaging
rewrite ^/imagedirect/(.*)$ /imagedirect.php?file=$1 last;
rewrite ^/thumb/(.*)$ /thumb.php?file=$1 last;
break;
}

Nginx redirect www.example.com requests to example.com or vice versa

Add following configuration directive if you want to redirect www.example.com to example.com

server {
    server_name  www.example.com;
    rewrite ^(.*) http://example.com$1 permanent;
}

server {
    server_name  example.com;
    Put here your domain hosting configuration.
}

Add following configuration directive if you want to redirect example.com to www.example.com

server {
    server_name  example.com;
    rewrite ^(.*) http://www.example.com$1 permanent;
}

server {
    server_name  www.example.com;
    Put here your domain hosting configuration.
}

Nginx and WordPress setup clean SEO friendly URLs

Open your nginx configuration file:

# nano /etc/nginx/nginx.conf

Locate your domain (example.com) virtual hosting configuration and before “location ~ \.php$ {” add following lines:

if (!-e $request_filename) {
  rewrite  ^(.*)$  /index.php?q=$1  last;
  break;
}

At the end your configuration should look as follows:

server {
    server_name     example.com;
    index           index.php;
    root            /var/www/example.com;

    if (!-e $request_filename) {
      rewrite  ^(.*)$  /index.php?q=$1  last;
      break;
    }  

    location ~ .php$ {
       fastcgi_pass  localhost:9999;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_NAME $fastcgi_script_name;
       fastcgi_param REQUEST_URI $request_uri;
       fastcgi_param DOCUMENT_URI $document_uri;
       fastcgi_param DOCUMENT_ROOT $document_root;
       fastcgi_param REMOTE_ADDR $remote_addr;
       fastcgi_param REMOTE_PORT $remote_port;
       fastcgi_param SERVER_ADDR $server_addr;
       fastcgi_param SERVER_PORT $server_port;
       fastcgi_param SERVER_NAME $server_name;
       fastcgi_param SCRIPT_FILENAME  /var/www/example.com$fastcgi_script_name;
       fastcgi_param QUERY_STRING $query_string;
       fastcgi_param REQUEST_METHOD $request_method;
       fastcgi_param CONTENT_TYPE $content_type;
       fastcgi_param CONTENT_LENGTH $content_length;
    }
}

Save and close the file. Restart nginx:

# /etc/init.d/nginx restart