修改nginx Web服务器的源代码
我想修改Nginx的源代码(http://nginx.org/download/nginx-0.7.67.tar.gz) 因此,当它提供文件(从磁盘读取文件)时,要计算提供的字节数并将它们存储在某个地方(可能是数据库) 因为我不太了解 C (我是一名 php 开发人员),所以我很难在源代码中找到该部分(必须看一会儿或其他什么) 有人能帮我吗? 谢谢
I want to modify the source code of Nginx (http://nginx.org/download/nginx-0.7.67.tar.gz)
so when it serves a file (reads the file from disk) to count the bytes served and store them somewhere (a datababase perhaps)
Since I don't understand C that well (I'm a php developer) I have trouble finding that part in the source coude (must be a look a while or something)
Can anyone help me with that?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是访问您希望 nginx 提供的信息的另一种方法,这种方法更安全。
将 bytes_sent 作为一列包含在访问日志中。
如果您参考 HttpLogModule 您会发现可以将 bytes_sent 指定为访问日志中的一列。将其与解析日志文件的 php 脚本结合起来(也许在旋转之后),您将能够避免 c.
这种方法的一些好处:
Here is an alternate approach to access the information you want nginx to provide that is much safer.
Include bytes_sent as a column in your access log.
If you refer to the HttpLogModule you'll see you can specify bytes_sent as a column in the access log. Combine this with a php script that parses the log file (Perhaps after it is rotated) and you'll be able to avoid c.
Some benefits to this approach: