无法连接到主机

时间:2013-12-25 18:24:46

标签: java nginx jetty

我一直在尝试将nginx设置为jetty的代理。我有一台笔记本电脑运行ubuntu服务器。现在我让jetty在localhost:8080工作,它在http://192.168.1.5:8080/my-webapp-0.1.0-standalone/提供应用程序的主页。

我像这样配置了nginx(I adapted it from this page):

server {
  listen 80;
  server_name nomilkfor.me;
  rewrite ^(.+?)/?$ http://nomilkfor.me$1 permanent;
}

server {
  listen 80;
  server_name www.nomilkfor.me;
  root /usr/share/nginx/html;

  location / {
    try_files $uri @my-webapp;
  }

  location @my-webapp {
    proxy_pass http://localhost:8080;
  }
}

我可以从家庭网络连接到nginx,我看到了nginx欢迎屏幕。

我也试过$ udo netstat -tanpl|grep nginx

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3264/nginx: worker 

我看到nginx正在侦听端口80,但是当我尝试加载nomilkfor.me时,我得到“Chrome无法连接到nomilkfor.me”错误。

我做错了什么?

我创建了一个非常简单的配置,而且这个配置也通过jetty为index.html中的/usr/share/nginx/而不是app提供服务:

server {
    listen 80;
    server_name nomilkfor.me;

    # access_log /var/log/nginx/localhost.access.log;

    location / {
        proxy_pass http://127.0.0.1:8080;
    }

    location /html { 
        root /usr/share/nginx/;
    }
}

似乎nginx正在使用另一个conf文件而不是我想的。我在conf文件/etc/nginx/sites-available/nomilkfor.me中添加了一个拼写错误(我删除了一个结束大括号)并运行了$ nginx -s reload并且编译时没有错误,并在浏览器上显示了nginx启动页面。某处可以有另一个conf文件吗?有没有办法找到nginx使用的conf文件?

0 个答案:

没有答案