Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nginx-clojure

> DevOps
Open source

Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.

1.1K stars0 likes0 views
WebsiteGitHub

About

Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.

Nginx-Clojure

Nginx-Clojure is a Nginx module for embedding Clojure or Java or Groovy programs, typically those Ring based handlers.

Core Features

The latest release is v0.6.0, more detail changes about it can be found from Release History.

  1. Compatible with Ring and obviously supports those Ring based frameworks, such as Compojure etc.
  2. Http Services by using Clojure / Java / Groovy to write simple handlers for http services.
  3. Nginx Access Handler by Clojure / Java / Groovy
  4. Nginx Header Filter by Clojure / Java / Groovy
  5. Nginx Body Filter by Clojure / Java / Groovy
  6. Nginx Log Handler by Clojure / Java / Groovy
  7. HTTP V2 support in both standard edition and embedded edition which are compiled against Nginx 1.18.0+
  8. Support Java 8, 9, 10, 11, 12, 19
  9. Support to use jdk19 built-in coroutine viz. Continuation
  10. Pub/Sub Among Nginx Worker Processes
  11. Shared Map based on shared memory & Shared Map based Ring session store
  12. Support Sente, see this PR
  13. Support Per-message Compression Extensions (PMCEs) for WebSocket
  14. APIs for Embedding Nginx-Clojure into a Standard Clojure/Java/Groovy App
  15. Server Side Websocket
  16. A build-in Jersey container to support java standard RESTful web services (JAX-RS 2.0)
  17. Tomcat 8 embedding support (so servlet 3.1/jsp/sendfile/JSR-356 websocket work within nginx!)
  18. Dynamic proxying by using Clojure / Java / Groovy to write a simple nginx rewrite handler to set var or return errors before proxy pass or content ring handler
  19. Non-blocking coroutine based socket which is Compatible with Java Socket API and works well with largely existing java library such as apache http client, mysql jdbc drivers. With this feature one java main thread can handle thousands of connections.
  20. Handle multiple sockets parallel in sub coroutines, e.g. we can invoke two remote services at the same time.
  21. Asynchronous callback API of socket/Channel for some advanced usage
  22. Long Polling & Server Sent Events
  23. Run initialization clojure code when nginx worker starting
  24. Support user defined http request method
  25. Compatible with the Nginx lastest most mainline version 1.23.3. (Nginx 1.22.X, 1.20.X, 1.18.x, 1.14.x, 1.12.x, 1.8.x, 1.6.x, 1.4.x is also ok, older version is not tested and maybe works.)
  26. One of benifits of Nginx is worker processes are automatically restarted by a master process if they crash
  27. Utilize lazy headers and direct memory operation between Nginx and JVM to fast handle dynamic contents from Clojure or Java code.
  28. Utilize Nginx zero copy file sending mechanism to fast handle static contents controlled by Clojure or Java code.
  29. Support Linux x64, Linux x86 32bit, Win32, Win64 and Mac OS X. Freebsd version can also be got from Freebsd ports.

By the way it is very fast, the benchmarks can be found HERE(with wrk2).

Jar Repository

Nginx-Clojure has already been published to https://clojars.org/ whose maven repository is

xml

  clojars.org
  http://clojars.org/repo

After adding clojars repository, you can reference nginx-clojure 0.6.0 , e.g.

Leiningen (clojure, no need to add clojars repository which is a default repository for Leiningen)

clojure
[nginx-clojure "0.6.0"]

Gradle (groovy/java)

compile "nginx-clojure:nginx-clojure:0.6.0"

Maven

xml

  nginx-clojure
  nginx-clojure
  0.6.0

Documents

  • Quick Start
  • Downloads
  • Installation
  • Configuration
    • JVM Path,Class Path & Other JVM Options
    • Initialization Handler for nginx worker
    • Content Ring Handler for Location
    • Coroutine/Asynchronous Client Channel/Thread Pool
  • Nginx Handlers
    • Nginx Rewrite Handler
    • Nginx Access Handler
    • Nginx Header Filter
    • Nginx Body Filter
    • Nginx Log Handler
  • Advanced Topic
    • Embedding Nginx-Clojure into a standard App
    • Server Channel for Long Polling & Server Sent Events
    • Pub/Sub Among Nginx Worker Processes
    • Shared Map & Session Store
    • Asynchronous Client Channel
    • About Logging
    • Sever Side WebSocket
    • Java standard RESTful web services with Jersey
    • Embedding Tomcat
    • Use Spring Framework with Nginx-Clojure Java Handlers
    • Example Project about Jersey & Spring with Nginx-Clojure
    • More about Nginx Worker Process
    • More about Nginx-Clojure
  • Directives Reference
  • API Reference (Clojure)
  • Example Projects
  • Github Repository of Documents

License

Copyright © 2013-2023 Zhang, Yuexiang (xfeep) and released under the BSD 3-Clause license.

This program uses:

  • Re-rooted ASM bytecode engineering library which is distributed under the BSD 3-Clause license
  • Modified Continuations Library written by Matthias Mann is distributed under the BSD 3-Clause license

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaclojuregroovyjavanginx

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理