Yves Yves - 6 months ago 38
C Question

how to use c/c++ module with nginx

I'm trying to build a web server with nginx.


My PC is a Mac OS so I just

brew install nginx
. It works well. I can execute
nginx
which is located at
/usr/local/bin/
to start the server. Also, when I visit
http://localhost
, I can get the main page, which is located at
/usr/local/var/www/index.html
.

However, I can't find any source code of nginx.


So I download its source code from here.

Now I'm confused. I don't know how to organize my project.


For example, for this hello world, it just need
#include <ngx_config.h> #include <ngx_core.h> #include <ngx_http.h>
. It seems that it could use the source code of nginx as a c standard library.


How can I do the same thing?

Where should I put my developed module?

Answer Source

These two seems like very good starting point to me:

http://www.evanmiller.org/nginx-modules-guide.html
http://nutrun.com/weblog/2009/08/15/hello-world-nginx-module.html

I haven't made any modules myself, but when I searched for one of my own problem solution I found the above links and these looks promising to me.

I will update you any progress I made during my experiment. And if you have already made any progress, please do share.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download