I'm trying to program an nginx module that discounts traffic from a Mysql database , upon a user based criteria. I don't know where to start I just know the concept of it, probably calling upon the event for sending bytes (let's say every 10 mb or so use a mysql library in C and do a query to discount the traffic) Is it possbile? can anyone give me some hints? I know there arrent' so many nginx developpers out there. I can do it on lighthttpd or apache I just need some help with it. Thank you
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I also tried to use nginx for C developments but finally opted for G-WAN.
Not only G-WAN's C scripts work faster than nginx modules but you don't have to configure anything and they play 'out-of-the-box'.
The traditional 'hello world' lets you see how this compares to nginx or Apache modules (ONLY 10 LINES OF CODE!):
http://gwan.ch/en_developers.html
One recent addition is the #prama link directive which lets you link your scripts with any existing library (just like mySQL, PostgreSQL or even SQLite).
There's an example with SQLite here:
http://gwan.ch/source/sqlite.c.txt