Nginx模块如何调试
编写nginx.conf,将nginx设置为单进程调试模式
worker_processes 1;error_log logs/error.log debug; # 记录调试日志 master_process off; # 单进程模式daemon off; pid /tmp/nginx_debug.pid;events { worker_connections 1024;}http { include /etc/nginx/mime.types; sendfile on; keepalive_timeout 65; tcp_nodelay on; server { listen 80; server_name localhost; access_log /tmp/access.log; error_log /tmp/error.log debug; location /hello { echo "helloworld"; } }}
daemon off;master_process off;
~/nginx-0.8.9/#./configure --add-module=/home/doyoueat/ngx_module_echo/ --with-debugmakesudo make install
~/nginx-0.8.9/#./objs/nginx -c /home/doyoueat/ngx_module_echo/nginx.conf -tthe configuration file /home/doyoueat/ngx_module_echo/nginx.conf syntax is okconfiguration file /home/doyoueat/ngx_module_echo/nginx.conf test is successful
~/nginx-0.8.9/#./objs/nginx -c /home/renlu/ngx_module_echo/nginx.conf
~#curl http://127.0.0.1/hellohelloworld