Quick Start

Installation

  1. Download the latest binaries release v0.5.3 from here.
  2. Unzip the zip file downloaded then rename the file nginx-${os-arc} to nginx, eg. for linux is nginx-linux-x64

If you want to compile it with your own nginx please check HERE

Configuration

  1. Open conf/nginx.conf file

  2. Setting JVM path and class path within http { block in nginx.conf

    ### jvm dynamic library path
    ### auto or a real path, e,g /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so
    jvm_path auto;
    	
    ### Set my app jars and resources, it must include nginx-clojure runtime jar,e.g. nginx-clojure-0.5.0.jar and 
    ##  for clojure user clojure runtime jar is also needed.
    ### See http://nginx-clojure.github.io/directives.html#jvm_classpath
    jvm_classpath 'libs/*'; #windows user should use ';' as the separator
    
  3. Setting Inline Http Service Handler

  1. Setting Compojure Router/External Http Service Handler

Note: For more advanced configurations such as enable coroutine based socket, thread pool etc. Please check them from HERE.

Start up

$ cd nginx-clojure-0.5.3
$ ./nginx

If everything is ok, we can access our first http service by this url

### For Clojure
http://localhost:8080/clojure

### For Clojure Compojure Router
http://localhost:8080


### For Groovy
http://localhost:8080/groovy

### For Java
http://localhost:8080/java

We can check the logs/error.log to see error information.

Reload

If we change some settings we can reload the settings without stopping our services.

$ ./nginx -s reload

Stop

$ ./nginx -s stop

Examples

clojure-web-example

A basic example about nginx-clojure & clojure web dev. It uses:

See it on github.