service not working with nginx

18 views
Skip to first unread message

Phani Pramod

unread,
Nov 27, 2020, 12:19:06 AM11/27/20
to ngrest
I am using ngRest on my Rasberry PI 3 Model B
I have nginx version 1.14.2
After making necessary changes to /etc/nginx/nginx.conf and /etc/nginx/sites-enabled/default

My ngRest service has 2 end points
1. /service/{text}
2. /service/query?command={command}

On standalone ngrest server both the end-points work fine.

In /etc/nginx/sites-enabled/default, I have the following configured

location /ngrest/service/ {
}

location /service/ {
ngrest /home/pi/Projects/C-Projects/ngRest/Service/.ngrest/local/build/deploy/share/ngrest/services;
}

The REST end-point, /service/query?command={command}, works fine on ngrest and also when using the nginx with /ngrest/service/query?command=CMD1
But it fails with ngrest module, i.e. when using /service/query?command=CMD1
However it works with /service/{CMD1}.

Has it got something to do with Unicode string or any other conversion.
Below is the signature of the service
//! Send command to inverter and returns its response
    // *method: GET
    // *location: /query/{command}
    std::string query(const std::string& command);

I am using a third party library, simpleio, to communicate with a serial port, which accepts char* , hence I am using the std::string::c_str() to convert std::string to char *.

Can someone, please help me with some pointers, on why it would not work with ngRest nginx module.

Thank you

Best Regards
Phani



loe...@gmail.com

unread,
Nov 27, 2020, 5:26:07 AM11/27/20
to ngrest
Could you attach some logs and additional info so the problem can be deduced?

Phani Pramod

unread,
Nov 27, 2020, 12:10:36 PM11/27/20
to ngrest
Can you please me with some pointer or documentation that I can go through to generate logs when deployed on nginx or should I attach nginx logs (access and error log).
Please let me know the additional info that you would like me to send.

Thank you 
Best Regards
Phani

loe...@gmail.com

unread,
Nov 27, 2020, 12:39:26 PM11/27/20
to ngrest
You may try using the NGREST_LOG_FILE environment variable, set it to the something like /tmp/ngrest.log

NGREST_LOG_LEVEL may be sufficient too, set it to TRACE

These environment variables can be set from nginx.conf using env directive.

loe...@gmail.com

unread,
Nov 27, 2020, 12:40:12 PM11/27/20
to ngrest
Ah and nginx logs may be helpful too.
Reply all
Reply to author
Forward
0 new messages