Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ansuel/nginx-ubus-module
Nginx module to interact with penwrt ubus daemon
https://github.com/ansuel/nginx-ubus-module
nginx openwrt ubus ubus-module
Last synced: about 2 months ago
JSON representation
Nginx module to interact with penwrt ubus daemon
- Host: GitHub
- URL: https://github.com/ansuel/nginx-ubus-module
- Owner: Ansuel
- License: bsd-3-clause
- Created: 2019-10-24T01:08:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T14:12:01.000Z (10 months ago)
- Last Synced: 2024-05-21T07:08:38.093Z (8 months ago)
- Topics: nginx, openwrt, ubus, ubus-module
- Language: C
- Homepage:
- Size: 146 KB
- Stars: 7
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/AnsuelS) [![License](https://img.shields.io/github/license/Ansuel/nginx-ubus-module.svg?style=flat)](https://github.com/Ansuel/nginx-ubus-module/blob/master/LICENSE)
# Module ngx_http_read_request_body_module
The `ngx_http_ubus_module` module allows access ubus function directly from nginx without using cgi or additional application to connect to it
Ubus is used in openwrt to gain and set data to the system. Alle the comunication are done in json format.
This can be used to make gui that are based on only ubus request and calls.This is based on `uhttpd-mod-ubus` module, some procedures are took from `uhttpd` module.
## Configuration example
```nginx
location /ubus {
ubus_interpreter;
ubus_socket_path /var/run/ubus.sock;
ubus_script_timeout 600;
ubus_cors off;
}
```## Directives
Syntax: ubus_interpreter;
Default: —
Context: locationEnable ubus_interpreter on the location set
Syntax: ubus_socket_path;
Default: —
Context: locationThe path to the socket the module will connect to. Without this the module will report a json error with Internal Error
Syntax: ubus_script_timeout;
Default: 60
Context: locationUbus connection will be terminated after the timeout is exceeded
Syntax: ubus_cors;
Default: 0
Context: locationAdds cors header security options to every response header
Syntax: ubus_noauth;
Default: 0
Context: locationOnly for test purpose. This will denied every request.
## Thread support
With Nginx compiled with threads support `--with-threads`, module will use (and requires) Nginx Thread Pool feature. As Nginx configuration suggest, this module will require in the main configuration a Thread Pool and in the location section reference to the named Thread Pool with the name `ubus_interpreter`.
thread_pool ubus_interpreter threads=16;
location /ubus {
ubus_interpreter;
ubus_socket_path /var/run/ubus/ubus.sock;
ubus_parallel_req 20;
aio threads=ubus_interpreter;
}Ubus itself doesn't like concurrent request so the performance benefits from this
are minimal, but this will permits to speedup and prepare each request by removing
the overhead of blocking nginx execution waiting for ubus response.