February 01, 2017 05:00PM
Hi all,

I'm trying to write a custom nginx module using c++ instead of c because one of my dependencies is written in c++. I am trying to run this with nginx 1.10.2 on centos 7.

Here is the cpp file :
http://pastebin.com/mykxhh82

Here is the header file :
http://pastebin.com/LUFcHDHA

Here is the config file :
ngx_addon_name=ngx_http_embedded_cpp_module
HTTP_MODULES="$HTTP_MODULES ngx_http_embedded_cpp_module"
CORE_LIBS="$CORE_LIBS -lstdc++"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS /root/Documents/embeddedNetAcuity/ngx_http_embedded_cpp_module.cpp"

This is my configuration when building from source :
./configure --with-ld-opt="-lstdc++" --add-module=/root/Documents/embeddedCpp/ --with-debug --with-http_realip_module --prefix=/usr/share/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --with-ipv6 --with-cc-opt='-O0 -g'

The code compiles fine with make and make install.

When I try
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
to start the server, I just get a one line error of "segmentation fault"

I checked the error.log file and it's completely empty. I also followed the steps on nginx's website to try and obtain a core dump, but no dump file gets created in my directory. What am I doing wrong and how can I go about determining what exactly is wrong in the future? No one in my office knows how nginx works and I couldn't find any documentation on this issue.

Thanks everyone,
Someone pulling his hair out
Subject Author Posted

Help with custom simple c++ nginx module? Segmentation fault on startup

de_nginx_noob February 01, 2017 05:00PM

Re: Help with custom simple c++ nginx module? Segmentation fault on startup

de_nginx_noob February 02, 2017 01:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready