{"id":18620453,"url":"https://github.com/jason-gao/ngx_lua","last_synced_at":"2026-04-26T22:31:16.482Z","repository":{"id":90733540,"uuid":"119360287","full_name":"jason-gao/ngx_lua","owner":"jason-gao","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-29T09:23:21.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T04:34:29.652Z","etag":null,"topics":["lua","nginx","openresty"],"latest_commit_sha":null,"homepage":null,"language":null,"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/jason-gao.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-29T09:20:10.000Z","updated_at":"2018-01-29T09:20:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ccdee9b-086c-444d-9085-c6f57e03674d","html_url":"https://github.com/jason-gao/ngx_lua","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"46a2083685bb3bec78d89708b7d9f9db737accce"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jason-gao/ngx_lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-gao%2Fngx_lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-gao%2Fngx_lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-gao%2Fngx_lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-gao%2Fngx_lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jason-gao","download_url":"https://codeload.github.com/jason-gao/ngx_lua/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jason-gao%2Fngx_lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32315711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T21:09:39.134Z","status":"ssl_error","status_checked_at":"2026-04-26T21:09:21.240Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["lua","nginx","openresty"],"created_at":"2024-11-07T04:06:14.176Z","updated_at":"2026-04-26T22:31:16.465Z","avatar_url":"https://github.com/jason-gao.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 安装\n* OpenResty® 提供官方的预编译包\n\n## ubuntu\n* 导入我们的 GPG 密钥\n    * wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -\n* 安装 add-apt-repository 命令\n    * sudo apt-get -y install software-properties-common\n* 添加我们官方 official APT 仓库\n    * sudo add-apt-repository -y \"deb http://openresty.org/package/ubuntu $(lsb_release -sc) main\"\n* 更新 APT 索引\n    * sudo apt-get update\n* sudo apt-get install openresty    \n* 这个包同时也推荐安装 openresty-opm 和 openresty-restydoc 包，所以后面两个包会缺省安装上。 如果你不想自动关联安装，可以用下面方法关闭自动关联安装：\n  \n      sudo apt-get install --no-install-recommends openresty\n      \n## centos\n*   sudo yum install yum-utils\n*   sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo\n*   sudo yum install openresty\n*   sudo yum install openresty-resty\n*   sudo yum --disablerepo=\"*\" --enablerepo=\"openresty\" list available\n\n\n\n# 使用 hello world nginx.conf\n```\nworker_processes  1;\nerror_log logs/error.log;\nevents {\n    worker_connections 1024;\n}\nhttp {\n    server {\n        listen 8080;\n        location / {\n            default_type text/html;\n            content_by_lua '\n                ngx.say(\"\u003cp\u003ehello, world\u003c/p\u003e\")\n            ';\n        }\n    }\n}\n```\n\n* PATH=/usr/local/openresty/nginx/sbin:$PATH\n* export PATH\n* nginx -p `pwd`/ -c conf/nginx.conf\n\n* curl http://localhost:8080/\n## benchmark ab\n* ubuntu \n    * apt install apache2-utils\n    * ab -c10 -n50000 http://localhost:8080/\n```\nThis is ApacheBench, Version 2.3 \u003c$Revision: 1706008 $\u003e\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking localhost (be patient)\nCompleted 5000 requests\nCompleted 10000 requests\nCompleted 15000 requests\nCompleted 20000 requests\nCompleted 25000 requests\nCompleted 30000 requests\nCompleted 35000 requests\nCompleted 40000 requests\nCompleted 45000 requests\nCompleted 50000 requests\nFinished 50000 requests\n\n\nServer Software:        openresty/1.13.6.1\nServer Hostname:        localhost\nServer Port:            8080\n\nDocument Path:          /\nDocument Length:        20 bytes\n\nConcurrency Level:      10\nTime taken for tests:   1.752 seconds\nComplete requests:      50000\nFailed requests:        0\nTotal transferred:      8400000 bytes\nHTML transferred:       1000000 bytes\nRequests per second:    28545.25 [#/sec] (mean)\nTime per request:       0.350 [ms] (mean)\nTime per request:       0.035 [ms] (mean, across all concurrent requests)\nTransfer rate:          4683.20 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   0.1      0       8\nProcessing:     0    0   0.2      0       9\nWaiting:        0    0   0.2      0       8\nTotal:          0    0   0.2      0       9\n\nPercentage of the requests served within a certain time (ms)\n  50%      0\n  66%      0\n  75%      0\n  80%      0\n  90%      0\n  95%      1\n  98%      1\n  99%      1\n 100%      9 (longest request)\n```      \n \n* 重载  openresty -s reload\n\n## 修改server头  header_filter_by_lua\n\n```\nserver{\n        listen 8080;\n        location / {\n                default_type text/html;\n                header_filter_by_lua '\n                        ngx.header[\"server\"] = \"jasong openresty\"\n                ';\n\n                content_by_lua '\n                        ngx.say(\"\u003cp\u003ehello, world\u003c/p\u003e\")\n                ';\n        }\n}\n\n```\n      \n    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjason-gao%2Fngx_lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjason-gao%2Fngx_lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjason-gao%2Fngx_lua/lists"}