【发布时间】:2013-12-21 03:29:32
【问题描述】:
我有这个设置:
我在用作服务器的 ubuntu 机器上安装了 nginx 和 Jetty。我测试了 Jetty,它在 0.0.0.0.:8080 上运行,我看到了 Jetty 欢迎页面。
我将使用的域是 nomilkfor.me。 nginx conf 文件在/etc/nginx/sites-available/nomilkfor.me.conf.
我正在另一台笔记本电脑 (OSX) 上编程,并使用 lein 创建了一个项目 web_test。我创建了一个web_test 的.war 文件,当我运行lein ring server 时,我在浏览器上看到了core.clj 的内容。
最初,我在this answer 之后设置了 nginx conf 文件,但我无法使其工作。
我想问一下如何修复下面的 conf 文件(带着我的问题)以及如何使用 nginx 作为代理来部署 web_test。
我粘贴了下面的 conf 文件并为每个指令添加了我的问题:
# 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;
}
}
注意:这是我关于同一主题的第三个问题,但我仍然无法解决。感谢大家的帮助。
【问题讨论】:
标签: java nginx clojure proxy jetty