Friday, July 31, 2009

apache fail

Don't use apache2-mpm-worker for perl projects. Never!

never

NEVER! :)

Wednesday, July 22, 2009

nginx basic auth (htpasswd)

Nginx supports basic auth (ngx_http_auth_basic_module)

directives:
auth_basic [|off]
auth_basic_user_file path/to/file

htpasswd file format:
# comment
login:password

Command htpasswd should be used with option -d , because nginx supports crypt() algorithm only.

Example:
htpasswd -c -d /etc/nginx/htpasswd asalnikov

nginx.conf part:
location /
{
auth_basic "closed site";
auth_basic_user_file /etc/nginx/htpasswd;
...
}

Sunday, July 12, 2009

Kubuntu Jaunty Wi-Fi Speed with WPA2 encryption

After upgrading my Kubuntu to Jaunty, I had problems with Internet access via Wi-Fi. Speed was many times less than before the upgrade (only then I use WPA2 encryption). This way solve the problem:

$ sudo aptitude install linux-image-2.6.28-11-generic

and reboot, choosing this kernel

P.S. in KDE4, NetworkManager replaced by plasma-widget-network-manager. If you can't connect to your wi-fi network with WPA2 encryption just install "linux-backports-modules-jaunty-generic" package.

Thursday, July 9, 2009

ssh tunnels

In many cases, development projects are on the same data center, and the server product is on the other. And often it is necessary to provide the link between the test and product servers.

Simply ssh tunnel:

ssh -p40088 -2 -N -C -f -L 172.11.5.58:3307:10.20.1.103:3306 tunnel@x.x.x.x

-p40088 - gateway to production DC ssh port
172.11.5.58:3307 - host:port on local server
10.20.1.103:3306 - host:port on remote server
tunnel@x.x.x.x - username@host of gateway to production DC


And now when I connect to port 3307 on local server I get connect with 10.20.1.103:3306 on production server.

Monday, July 6, 2009

How to copy directories structure

cd olddir
find . -type d > /tmp/dirlist
cd newdir
for i in `cat /tmp/dirlist` ; do mkdir -p $i ; done

very simply :)