{"id":22933643,"url":"https://github.com/nginx-modules/ngx_http_handlersocket_json_module","last_synced_at":"2026-04-12T12:49:44.094Z","repository":{"id":15914921,"uuid":"18656612","full_name":"nginx-modules/ngx_http_handlersocket_json_module","owner":"nginx-modules","description":"the nginx module for direct access to MySQL data (by HandlerSocket) and pass data in JSON format","archived":false,"fork":false,"pushed_at":"2011-04-15T07:55:12.000Z","size":204,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T11:53:51.776Z","etag":null,"topics":["handlersocket","json","module","mysql","nginx"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nginx-modules.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-11T00:10:13.000Z","updated_at":"2023-06-09T07:26:29.000Z","dependencies_parsed_at":"2022-08-30T18:22:04.732Z","dependency_job_id":null,"html_url":"https://github.com/nginx-modules/ngx_http_handlersocket_json_module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx-modules%2Fngx_http_handlersocket_json_module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx-modules%2Fngx_http_handlersocket_json_module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx-modules%2Fngx_http_handlersocket_json_module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nginx-modules%2Fngx_http_handlersocket_json_module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nginx-modules","download_url":"https://codeload.github.com/nginx-modules/ngx_http_handlersocket_json_module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246690450,"owners_count":20818326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["handlersocket","json","module","mysql","nginx"],"created_at":"2024-12-14T11:32:39.115Z","updated_at":"2026-04-12T12:49:39.049Z","avatar_url":"https://github.com/nginx-modules.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Introduction\n\nNGX_HTTP_HANDLERSOCKET_JSON_MODULE is an [nginx] (http://nginx.org/) module to get full use of [HandlerSocket] (https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL) for [MySQL] (http://www.mysql.com). \n\n### Installation\n\n1. Configure nginx with option --add-module=/full/path/to/dir/nginx_http_handlersocket_json_module\n2. make\n3. sudo make install\n\n### Configuration\n\nConfiguration options should be used in a location context of nginx config file.\n\n#### Example 1\n\n\tlocation ~ /cities/(.+)/$ {\n\t\ths_json;\t\t\t\t# enable module\n\n\t\ths_json_host 127.0.0.1;\t# IP address of MySQL server (127.0.0.1 by default)\n\t\ths_json_port 9998;\t\t# port at which HandlerSocket is listening (9998 by default)\n\n\t\ths_json_db test;\t\t# database name\n\t\ths_json_table city;\t\t# table name\n\n\t\ths_json_index name;\t\t# index name (PRIMARY key is used by default)\n\t\ths_json_fields name,id;\t# fields to include in output\n\n\t\ths_json_op \"=\";\t\t\t# operator (\"=\" by default)\n\t\t\t\t\t\t\t\t# possible values: =, \u003c, \u003c=, \u003e, \u003e=\n\t\ths_json_limit 10;\t\t# maximum number of records to be returned (10 by default)\n\n\t\tset $hs_request $1;\t\t# the set source input data \n\t}\n\nThis example will produce the following output:\n\n\tcurl http://localhost/cities/san/\n\t[{\"name\":\"San Amaro\", \"id\": \"12\"},{\"name\":\"San Andreas\", \"id\": \"13\"},{\"name\":\"San Andrs\", \"id\": \"14\"} ... ]\n\n#### Example 2\n\nSetting GET variable as a search parameter:\n\n\tlocation ~ /json {\n\t\tset $hs_request $get_id;\n\t}\n\n### Errors\n\n* 500 — incorrect configuration or some sort of protocol misbehaviour/misconfiguration or HadlerSocket error\n* 503 — IO error or connection error while trying to connect to HandlerSocket\n\nIn case of empty set error 404 will NOT be returned. Instead an empty JSON response ({[]}) will be generated.\n\t\n### Limitations\n\n* Output data size is limited to 1Kb. You can increase this limit by changing BUFF_SIZE constant (`#define BUFF_SIZE`).\n* Only one field can be used as search criteria.\n\n### More info\n\n[Original description at Habrahabr] (http://habrahabr.ru/blogs/nginx/115920/) (in Russian).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnginx-modules%2Fngx_http_handlersocket_json_module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnginx-modules%2Fngx_http_handlersocket_json_module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnginx-modules%2Fngx_http_handlersocket_json_module/lists"}