nginx/mod_userdir: take 2

My previous attempt is pretty much a fail. It works but it shouldn’t be done that way.

Here be updated version to imitate mod_userdir functionality in nginx – pointing /~username to correct path. Complete with php(-cgi) handler.

upstream php-cgi {
        server 127.0.0.1:9000;
}
server {
listen 80;
        server mahleetserver.com;
        index index.php;
        client_max_body_size 3m;

        if ($uri ~ ^/~edho/blog) {
                set $err404 /~edho/blog/index.php;
                set $is_custom404 1;
        }

        if ($is_custom404 != 1) {
                set $err404 /404.html;
        }
        error_page 404 $err404;

        #username should only contain these letters, right?
        location ~ /~([A-Za-zd-_s]+)(.*)$ {
                alias /export/home/$1/public_html$2;
                location ~ .php {
                        if ($fastcgi_script_name ~ /~([A-Za-zd-_s]+)(.*)$ {
                                set $ud_name $1; set $ud_uri $2;
                        }
                        root /export/home/$ud_name/public_html;
                        try_files $ud_uri @404;
                        fastcgi_pass php-cgi;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$ud_uri;
                        include fastcgi_params;
                }
        }

        location / {
                root /var/www/data;
                rewrite ^/wiki/([^?]*)(?:?(.*))? /w/index.php?title=$1&$2;
                rewrite ^/wiki /w/index.php;
                rewrite ^/edogawaconan/signature.jpg /edogawaconan/signature.php;
        }
        location ~ .php$ {
                root /var/www/data;
                try_files $uri @404;
                fastcgi_pass php-cgi;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
        location ~ /.ht {
                deny all;
        }
        location @404 {
                return 404;
        }

}

Key changes here is everything is done in simplest possible way I can think of. No more location hopping.

If you need custom 404 just add if ($uri) block. In the sample above I have my blog at /~edho/blog.

I use upstream block to prepare migration to god (from php-fpm).

Up next: god config for php-cgi. (aka say goodbye to spawn-fcgi / php-fpm)

Update: cleanup

Cheat sheet fail

Indonesian news.

To sum it up: 19 highschools in Indonesia, 100% of their last grade students failed national final exam (er, dunno what’s this should be in English).

Reason: incorrect/fakeย cheatย (answer) sheet.

Good job to whoever made that cheat (answer) sheet.

My take: burn the schools together with all the staffs involved. Or perhaps just ban them from teaching or anything that involves school activities. The students, well, should just take another year. It’ll most likely just ended as ‘blame game’ though.

[ source (Indonesian) ]

Double-click drag with touchpad

I just found today that to do double-click drag with touchpad (tapping) is pretty simple: tap – delay – double tap.

Triple tap doesn’t work because between first two taps and third tap (and drag) confused the touchpad between double click or tap drag (click-drag by double tapping then dragging).

Useless tips ftw. XD

Random things about OS and Web Server

easy to deply, difficult to maintain

easy to deploy, difficult to maintain

This one is sure NOT how you should name your program.

Well, functionality-wise, it looks good. I will try it sometime next week since REE/passenger setup is PITA in term of management. Not to mention there’s annoying bug regarding kill -HUP `cat /var/run/nginx.pid` (that is, the passenger is spawned again while the old one isn’t killed).

Also re-evaluating my choice of ZFS and OpenSolaris (namely pure-ftpd is not working as it should).

Linux still sucks though.

I accidentally Google Chrome 2

I thought I downloaded Google Chrome 1 – latest stable version – or so I thought. Few minutes later, I see on slashdot that Google Chrome 2 has been released. At 2.0.172.28, it’s marked stable and pushed as stable release on Chrome website (where I downloaded the installer).

In simple words – it’s faster than Firefox (3.5 Beta 4). For Google Reader, at least. In Firefox, it takes about one second after clicking before it showed the feed while it’s instaneous in Chrome.

On unrelated news, CANAAN OP single flac tonight. I’ve uploaded it to mediafire yesterday and will seed tonight (in 12 hours or so).

danbooru, memcache and postgresql

Apparently some people got here when googling for “danbooru memcache” – which means I’m not the only one having problem with it.

I posted the solution in there which is pretty simple:

For memcache error (“uninitialized memcache constant”), add this line in config/initializer/002_caching.rb (at line 2):

require 'memcache'

As for postgresql error, comment the line following line in db/migrate20090420182044_revert_enable_auto_complete_on_users.rb (line 3):

remove_column "users", "enable_autocomplete`"

so it looks like this:

#remove_column "users", "enable_autocomplete`"

I don’t know why it’s still unfixed.

Updated installation guide soon, or later. Tell me if you need help for specific Linux distro. Or a variant of *BSD. Installation on OpenSolaris is still painful as ever (and Passenger 2.2.2 doesn’t work on it last time I tried).

Distracted, I am

The main reason I still watching Phantom

The main reason I still watch Phantom. The other is it's actually good, IMO.

Actually, ‘distracted’ is not quite accurate. ‘Escaping’ is better word for what I’m doing this past few days. And maybe in next few days, too. Until I’m forced back to reality.

Btw, Phantom is good. So is Tears to Tiara (lol @ accidental harem).

This blog is running WordPress 2.8-beta1

wordpress-logo-hoz-rgb

It’s entered beta phase already ๐Ÿ˜ฎ

Few days ago it was -almost-beta (lol) and I just realized today the version has changed to beta1.

Using svn is indeed the best way to keep web applications updated. Updating them is now two step process at most – svn up or svn sw, and then do database upgrade if needed. No more need to deactivate plugins – still needed if it’s major jump though but doable even without doing that. Just the effect is not really good. Also no need to ‘clean up’ the blog directory to upload new (hundreds) files.

Some applications have incremental upgrade, yes. It’s not the case for WordPress though.

(And really, using svn is easy)

[ what’s new in 2.8 | use svn for your wp ]

Faylan – CANAAN Promo(?) Single

amusic = aether-music.

Apparently no one bothered releasing this even though C75 is 6 months ago (December 2008). Or so tokyotosho said. It is there, in mp3 format. Hur hur.

Here it is. I think it’s the single. Probably. It sucks if it really is then – it’s not easily available (Comiket stuff). We’ll see if there will be another, non-comiket release for this one. It is not.

Mirror on mediafire. My upload speed sucks. And according to editor at Hydrogenaudio, Vorbis generally reaches transparency on q 5 (and this one is q 6). From same source, mp3 at 320kbps might be not transparent yet.

Tell me if you want lossless version. Or the accompanying music video.

[ mediafire | torrent (nyaa) ]

Random: nice torrent ID on nyaa. Lol.

Eve no Jikan / Time of Eve episodde 4 sometimes this month. Or next month. Depending on how distracted I am.

Update: it is not.

nginx.conf for danbooru+passenger/mongrel

In this I assumed that passenger’s nginx is running on another server/instances/port. It’s a waste of memory, but my current setup forced me to do this.

upstream passenger {
        server 10.0.0.9:8000;
}
server {
        listen 80;
        server_name mycoaldanbooruserver.lol;
        root /var/www/rails/danbooru/public;
        client_max_body_size 30m;
        location /(data|javascripts|stylesheets) {
                expires max;
                break;
        }
        location /maintenance.html {
                expires 10;
        }
        location / {
                try_files /maintenance.html $uri @genboard;
        }
        location @genboard {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://passenger;
        }
        error_page 404 /404.html;
        error_page 500 502 503 504 /500.html;
}

Basically it simplifies the setting using 0.7’s try_files and regex-in-location method. Also usable if you happen to use mongrel(_cluster).

What’s the deal with some of those scanlators?

Sir, yes sir! Apparently I'm a moron by their standard.

Sir, yes sir! Apparently I'm a moron by their standard.

Mainly with “no mirror”, “register and post to download”, “do not post links anywhere”.

Also apparently there are some problems between scanlators and fansubbers-doing-scanlations. Like this. Or this.

I also remember crafting some lengthy post (in my brain) of comparison between scanlating and fansubbing. I got bored later and decided not to create the post. Or maybe will if I get motivated one day.

What will happen if someone upload the scanlation somewhere?

  • They will drop the project. If one of their intention ‘managing’ the release is to get the money used to buy the manga back then it means they can’t get money at all after dropping the project. And in this case apparently they bought at least one volume already. And you guys are not the only one capable of scanlating manga – even a mid-schooler can do that. Yes that’s me years ago – done with Microsoft PhotoDraw 2000. At least I know that I need to grayscale the scans first. My English still sucks though ๐Ÿ™
  • Add more restriction. Because those guys scanlate manga for themselves and the people they can control. How about implementing DRM on scanlations so they can better control the circulation of their scanlations?
  • Something else.

Trackback and the mirror for flamebait.

[ Kiss x Sis chapter 24 by AnimeSigma | mediafire mirror ]

K-On! 6: ROF

…LMAO.

Well, in Mio’s case it’s only ROF. Or fall instead of roll. ๐Ÿ˜†

The way they do that scene is…. XD

The common question then is whether it’ll be changed in widescreen/DVD version.

And lol @ sponsor screen background.

</late>

Shangri-La op lyrics

Just checked Nekomimi’s release and find that they love karaoke (but no chapter – instant fail)

Donna basho de donna koe de doushitai de

Awanaideru arado

Sou janai sekai wa doukoku ni owatterunda

Hajimari na ate miataranai

Wakaru yo kimi ga misenai itami mo zenbu

Kono karada de kanjitai kara

Jibun ni nani ga dekiru ka doukana tte

Hashiri de shite hajimete kizuku deshou

Kimi shinitamou kotonakare

Yami no hate ne wo korashitayo

Doko de donna koe de doushitai de

Awanaideru arado

Emphasized means the parts I doubt to be correct.

The correct lyrics should be available this week.