Menu

Tree [21d594] master / nginx-clojure-embed /
 History

HTTPS access


File Date Author Commit
 src 2017-05-06 xfeep xfeep [47c9da] add keySet/valueSet in shared map for debug usa...
 test 2017-05-06 xfeep xfeep [0375b2] make body filter more safe under thread-pool mode
 .classpath 2015-08-11 xfeep xfeep [d0e904] APIs for Embedding Nginx-Clojure into a Clojure...
 .cproject 2015-08-11 xfeep xfeep [d0e904] APIs for Embedding Nginx-Clojure into a Clojure...
 .gitignore 2015-08-11 xfeep xfeep [d0e904] APIs for Embedding Nginx-Clojure into a Clojure...
 .project 2015-08-11 xfeep xfeep [d0e904] APIs for Embedding Nginx-Clojure into a Clojure...
 LICENSE 2015-08-11 xfeep xfeep [d0e904] APIs for Embedding Nginx-Clojure into a Clojure...
 README.md 2017-05-28 xfeep xfeep [7c0e7f] prepare for release v0.4.5
 configure 2015-10-22 xfeep xfeep [ecb206] build script:change build temp path
 project.clj 2017-05-06 xfeep xfeep [22b74f] change version to 0.4.5

Read Me

nginx-clojure-embed

Embeding Nginx-Clojure into a standard java/clojure app without additional Nginx process.
It can make test/debug with nginx-clojure clojure/java handler quite easy.

Jar Repository

For Clojure

[nginx-clojure/nginx-clojure-embed "0.4.3"]

For Java (Maven)

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>
<dependency>
  <groupId>nginx-clojure</groupId>
  <artifactId>nginx-clojure-embed</artifactId>
  <version>0.4.3</version>
</dependency>

Start/Stop Embedded Server

For Clojure

    ;;(1) Start it with ring handler and an options map
    ;;my-app can be a simple ring hanler or a compojure router.
    (run-server my-app {:port 8080})


   ;;(2) Start it with a nginx.conf file
    (run-server "/my-dir/nginx.conf")

   ;;(3) Start it with a given work dir
    (binding [*nginx-work-dir* my-work-dir]
      (run-server ...))

   ;;(4) Stop the server
    (stop-server)

For Java

//Start it with ring handler and an options map
NginxEmbedServer.getServer().start("my.HelloHandler", ArrayMap.create("port", "8081"));


//Start it with with a nginx.conf file
NginxEmbedServer.getServer().start("/my-dir/nginx.conf");

//Start it with a given work dir
NginxEmbedServer.getServer().setWorkDir(my-work-dir);
NginxEmbedServer.getServer().start(...);


//Stop the server
NginxEmbedServer.getServer().stop();

Default Options

          "error-log", "logs/error.log",
          "max-connections", "1024",
          "access-log", "off",
          "keepalive-timeout", "65",
          "max-threads", "8",
          "host", "0.0.0.0",
          "port", "8080",

User defined zones

          ;;;at nginx.conf top level
          "global-user-defined", "",

          ;;;at nginx.conf http block
          "http-user-defined", "",

          ;;at nginx.conf types mapping block
          "types-user-defined", "",

          ;;at nginx.conf server block
          "server-user-defined", "",

          ;;at nginx.conf location block
          "location-user-defined", "" 

License

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

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.