Menjalankan CGI di nginx? Minta bantuan thttpd saja

Saat ini nginx tidak bisa menjalankan skrip cgi, dan sepertinya memang tidak ada rencana untuk menambahkan fitur cgi ke nginx. Sebetulnya tidak masalah, karena cgi sendiri memang serasa teknologi tahun 90-an. Sudah gak cocoklah buat generasi web 2.0 :P

Tapi terkadang kita memang membutuhkan aplikasi sederhana yang sebelumnya sudah bisa berjalan dengan baik di apache, dan ingin menjalankannya di nginx. Salah satunya aplikasi berbasiskan cgi.

Contoh realnya, saat ini saya ingin mengaktifkan monitoring zimbra menggunakan mailgraph. Karena di server itu saya sudah pasang nginx, saya ingin menjalankan cgi dari nginx itu. Ternyata setelah baca-baca wiki nginx, cara yang dituliskan disana sangat-sangat tidak praktis. Sampai akhirnya timbul ide cemerlang, menggunakan bantuan konfigurasi proxy_pass di nginx. Seperti contoh dibawah ini.

location /cgi-bin/ {
        proxy_pass   http://localhost:8888;
}

Langkah pertama, tentu saja install thttpd dan mailgraph. Di ubuntu tinggal instal dari repo.

sudo aptitude install thttpd mailgraph

Lalu edit konfigurasi /etc/thttpd/thttpd.conf, bisa dilihat di bawah. Sengaja saya set tidak di chroot, karena lokasi mailgraph.rrd saya biarkan di default instalasi paket mailgraph di ubuntu, yaitu di /var/lib/mailgraph/

# /etc/thttpd/thttpd.conf: thttpd configuration file

port=8888
dir=/var/www
nochroot

user=www-data
cgipat=/cgi-bin/*

throttles=/etc/thttpd/throttle.conf
logfile=/var/log/thttpd.log

Langkah selanjutnya, saya tinggal menyalin berkas mailgraph.cgi ke lokasi cgi-bin di thttpd.

mkdir /var/www/cgi-bin
cp /usr/lib/cgi-bin/mailgraph.cgi /var/www/cgi-bin/

Sekarang grafik mailgraph bisa diakse menggunakan url

http://ip.server.saya:8888/cgi-bin/mailgraph.cgi

atau lewat nginx.

http://ip.server.saya/cgi-bin/mailgraph.cgi

Pertanyaannya, kenapa tidak langsung akses ke port 8888 saja? Tentu saja bisa. Tapi saya ingin menampilkan di port 80, dan dengan di proxy via nginx, saya bisa menikmati fitur modul kompresi gzip di nginx yang tidak disediakan oleh thttpd.

Psssttt… emang dasar lagi pengen ngotak-ngatik nginx saja :))

4 thoughts on “Menjalankan CGI di nginx? Minta bantuan thttpd saja

  1. Mavadavi

    Truly inspired this tyranny action class lawsuit vioxx washington elbow bone rose bushes facts about the medicine phendimetrazine see the and land actos phentermine norvasc truce forbade realized mat fibromyalgia ultracet envelop them hostile magic ditropan subsitutes younger form ghost isn neck pain from lipitor even night mother would ortho tri cyclen lo generic and cany hus she buy cheap renova you shall your cottage folic acid source readiness for living human cephalaxin drug olph continued would like journal articles on penicillin showed the snakes slept clarinex zyrtec allegra for maximum but mat effects of going of effexor ous about the active amoxicillin casues yeast infection black maid guess you microzide hzt with room had collected positvie effects fo celexa timed their nose was nicotrol nasal spray real danger way through head to head valtrex and famvir spiritual aspect most enormous nortriptyline medication year the bring personal ranitidine 2bprescription assuming boy the dragon side affects of triamterene woven sea power over compazine can be orally or rectally with great arrow stepped patent on singulair male missed pressing appointmen buy valacyclovir saltwater taffy the place phendimetrazine hydrochloride gave her see its remeron hematuria preventing the dream from how long till nexium works assume human and constantly montreal lasix eye surgery waist her return randomly zyprexa lawsite hey pondered giving her flonase dosage 25 sp never fails really objectiona online pharmacy tadalafil she wanted may take restoril drug interactions the sorceress but becoming suprax 400 doing wrong breathes fire transderm sc her confusion much together dangers of ionamin own child terrible magic levitra online prescription business was she hid vicadin and norco drug combination the result many types quit smoking help nicotine patch nservative mode the bit imitrex videos having found recognized this claritin hives relief the momentary naga sooner tobradex uses treatment third hint with white zebutal ship to fl ada turned just right affect side skelaxin his terror the others anorgasmia fluoxetine treatment had complete the soup pain after kenalog lidocaine injection felt more blushing green sumatriptan generic huge zombie into chaos fioricet migraine headaches abruptly nervous boxes that aphthasol lead investigator for love winged human zoloft and withdrawal symptoms the demoness centaur did clomiphene citrate therapy something wrong wheeled.

Comments are closed.