I have this setup:
I installed nginx and Jetty on an ubuntu machine that I am using as the server. I tested Jetty and it is running on 0.0.0.0.:8080 and I see the Jetty Welcome page.
The domain that I will be using is nomilkfor.me. The nginx conf file is in /etc/nginx/sites-available/nomilkfor.me.conf
.
I am programming on an another laptop (OSX) and I created a project web_test
with lein. I created a .war
file of web_test
and when I run lein ring server
I see the content of core.clj
on the browser.
Initially, I set up nginx conf file after this answer but I could not make it work.
I want to ask how I can fix the conf file below (with my questions) and how to deploy web_test with nginx as proxy to jetty.
I pasted the conf file below and added my questions for each directive:
# what should the ip address and port be?
# i assume this instructs nginx to send request it receives on port 80 to Jetty server
upstream ring {
server ????? fail_timeout=0;
}
# what directory do I need to enter here?
# do I use the clojure project root?
# do I use ~/web_test/src ?
server {
root /?????;
# make site accessible from http://localhost
server_name nomilkfor.me;
location / {
# first attempt to serve request as file
try_files $uri $uri/ @ring;
}
# we will need to understand these settings
location @ring {
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $http_host;
# what do I use here???
# is http://ring; correct???
proxy_pass http://ring;
}
location ~ ^(assets|images|javascript|stylesheets|system)/ {
expires max;
add_header Cache-Control public;
}
}
Note: This is my third question about the same subject but I still could not solve. Thanks for all the help.
- Can I use Clojure with nginx?
- How to serve clojure pages with nginx?