容器技术交流

 找回密码
 立即注册
查看: 30118|回复: 25

错误信息 nginx: [emerg] host not found in upstream

[复制链接]
发表于 2011-8-1 20:07:53 | 显示全部楼层 |阅读模式
大家好,我用LuManager 来管理的VPS 新建网站以后,修改Apache相关的Apache和Nginx处理选择时,每日次都会提示如下问题:

您填写的内容有错,错误信息
nginx: [emerg] host not found in upstream "4.lum" in /usr/local/nginx/conf/vhost.test.conf:151 nginx: configuration file /usr/local/nginx/conf/vhost.test.conf test failed

和修改网站转向时,也会提示错误.

您填写的内容有错,错误信息
nginx: [emerg] invalid condition "$host" in /usr/local/nginx/conf/vhost.test.conf:69 nginx: configuration file /usr/local/nginx/conf/vhost.test.conf test failed

我问过爱洞特漏 说:新建的时候,不要使用apache,建好,再编辑的时候,再用apache
我试了一遍,也是提示这个错误..

还有就是我新建了子站,绑定了域名,也解析了,经测试,解析到的也是我的IP,可是访问就是提示无法访问..

现在我把他排到第一位了,也是无法解决!!!

顺便贴一下我的 vhost.test.conf

user  daemon;
worker_processes  4;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;
events {
    worker_connections  65535;
}
http {
include       mime.types;
default_type  application/octet-stream;
log_format  lu_access_log_1 '$remote_addr --- [$time_local] --- Bytes: $body_bytes_sent --- $request --- $status --- $http_referer';
log_format  lu_access_log_2 '$remote_addr --- [$time_local] --- Bytes: $body_bytes_sent --- $request --- $status --- $http_referer  --- $http_user_agent --- $http_x_forwarded_for --- $remote_user';
#access_log  /dev/null  combined;
#access_log  logs/access.log  main;
sendfile        on;
#tcp_nopush     on;
tcp_nodelay on;
#keepalive_timeout  0;
keepalive_timeout  120;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;

fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 64k;
server_names_hash_bucket_size 128;
client_max_body_size 2000M;
limit_zone   one  $binary_remote_addr  16m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 12k;
gzip_comp_level 3;
gzip_types text/plain application/x-javascript text/css application/xml;
#include vhost_default.conf;


server {
server_name   bbs.legouzaixian.com bbs.legouzaixian.cn *.legouzaixian.com ;
listen       80;
#鐢ㄦ埛璁よ瘉



# ------------ 301鍜?02杞?悜
  if ($host != ) {
   rewrite ^/(.*)$ bbs.legouzaixian.com/$1 permanent;
  }
# ------------
if (-d $request_filename) {
  rewrite ^/(.*)([^/])$ $scheme://$host/$1$2/ permanent;
}

# ------------


# ------------
# # set $index '';
# # if ($uri ~ /$ ){
  # # rewrite (.*) $uri$index redirect;
# # }

# location ~ \.()$ {
  #1
  # root /home/ftp/1520/jnlgzx_vicp_net-20110801-EXS/jnlgzx_vicp_net/bbs/;
  # proxy_store on;
  # proxy_temp_path "/home/ftp/1520/jnlgzx_vicp_net-20110801-EXS/jnlgzx_vicp_net/bbs/";
  # proxy_store_access user:rw group:rw all:rw;
  #2
  # proxy_cache mem_cache_4;
  
  # if (!-e $request_filename) {
   # proxy_pass ;
  # }
  # include proxy_pass.conf;
# }

# location ~ (?!)$ {
  # proxy_pass ;
  # include proxy_pass.conf;
# }

## location ~ /purge(/.*) {
  ## allow all;
  ## allow 127.0.0.1;
  ## deny all;
  ## proxy_cache_purge mem_cache_4 $1$is_args$args;
## }
# ------------
#  /var/log/nginx_vhost_log/4_error.log info;
#  /var/log/nginx_vhost_log/4_access.log lu_#_1;

  error_page 403 /__ErrorFiles__/403.html;
  error_page 404 /__ErrorFiles__/404.html;

  error_page 500 /__ErrorFiles__/500.html;
  error_page 501 /__ErrorFiles__/501.html;
  error_page 502 /__ErrorFiles__/502.html;


root   /home/ftp/1520/jnlgzx_vicp_net-20110801-EXS/jnlgzx_vicp_net/bbs/;

  ssi off;
  ssi_silent_errors off;
  ssi_types text/shtml;





location / {
  
  
   index  index.html index.htm index.shtml index.php;
   autoindex off;
  #  proxy_pass ;
  #  proxy_set_header Host $host;
  #  include proxy_pass.conf;
}

location /nginx_status {
  stub_status on;
  # off;
}
        
#------------
  location ~* \.(php[3-9]?|phtm[l]?)(\/.*)*$ {
   #  proxy_set_header Host $host;
   # include proxy_pass.conf;
  
    fastcgi_pass  127.0.0.1:9000;
    include enable_php.conf;
  }

location ~ /\.ht {
  return 403;
}
location ~ ssl.(key|crt)$ {
  return 403;
}

location ~ (favicon.ico|robots.txt) {
  expires 1d;
  log_not_found off;
  #   off;
  break;
}
  location ~* \.(gif|jpg|jpeg|png|bmp|swf)$ {
  #expires 6h;
   expires 6h;
   break;
  }
  location ~* \.(js|css)$ {
   expires 1h;
   break;
  }
}
#the end
}



第一次发帖..希望大家能帮忙解决一下问题!!谢谢!!
 楼主| 发表于 2011-8-1 20:26:23 | 显示全部楼层
本帖最后由 童话的彼得潘 于 2011-8-1 20:28 编辑

希望有人能帮忙一下呀!!!{:soso_e112:}
1.png
2.png
发表于 2011-8-1 22:56:12 | 显示全部楼层
升级到1.1.9,应该就没事了
 楼主| 发表于 2011-8-2 07:33:09 | 显示全部楼层
我是昨天刚刚安装的..已经是1.1.9了!!{:soso_e100:}
 楼主| 发表于 2011-8-2 07:49:30 | 显示全部楼层
目前Apache和Nginx无法切换,和301转向都无法使用...二级域名也无法绑定...

是不是都与vhost.test.conf文件有关?
因为切换和转向的时候都会提示vhost.test.conf错误...
发表于 2011-8-2 08:32:05 | 显示全部楼层
有可能是您的服务器不能连接外网
请修改一下/etc/resolv.conf
内容为:
  1. servername 208.67.222.222
复制代码
 楼主| 发表于 2011-8-2 10:10:00 | 显示全部楼层
我添加了一个..
目前的/etc/resolv.conf

nameserver 127.0.0.1
search localhost
nameserver 8.8.8.8
nameserver 58.30.221.193
nameserver 8.8.4.4
servername 208.67.222.222

服务器可以访问外网..以前安装过webmin,后来又卸载了..webmin绑定过的域名都可以访问..
奇怪的是,我目前LuManager 中没有绑定的域名,(之前用webmin绑定的),现在还可以访问.只不过访问到的是ID1的网站...

另外我用的是CentOs系统..是不是系统的文件造成了域名无法绑定?

还有vhost.test.conf 的事情也无法解决吗?
 楼主| 发表于 2011-8-2 10:22:50 | 显示全部楼层
还有我添加新网站和修改资料的时候,都会提示用户们添加失败..

但是再次查看,都已经修改成功了!!

这个是bug,还是我的问题?
发表于 2011-8-2 10:38:05 | 显示全部楼层
直接改成
servername 208.67.222.222只留一个便可
 楼主| 发表于 2011-8-2 11:48:05 | 显示全部楼层
还是不行,还是只有之前用webmin绑定的域名可以访问服务器,后来再添加的域名都无法访问..
 楼主| 发表于 2011-8-2 14:05:48 | 显示全部楼层
总感觉首先解决vhost.test.conf 问题...然后在排查域名问题!!呵呵..
发表于 2011-8-2 14:08:54 | 显示全部楼层
不是vhost.test.conf的问题
用ssh执行ping 127.0.0.1,看看是什么结果
 楼主| 发表于 2011-8-2 14:27:23 | 显示全部楼层

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.059 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.018 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.037 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=64 time=0.032 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=64 time=0.029 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=64 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=22 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=23 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=24 ttl=64 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=25 ttl=64 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=26 ttl=64 time=0.029 ms
64 bytes from 127.0.0.1: icmp_seq=27 ttl=64 time=0.023 ms
64 bytes from 127.0.0.1: icmp_seq=28 ttl=64 time=0.023 ms
64 bytes from 127.0.0.1: icmp_seq=29 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=30 ttl=64 time=0.029 ms
64 bytes from 127.0.0.1: icmp_seq=31 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=32 ttl=64 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=33 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=34 ttl=64 time=0.029 ms
64 bytes from 127.0.0.1: icmp_seq=35 ttl=64 time=0.033 ms
64 bytes from 127.0.0.1: icmp_seq=36 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=37 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=38 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=39 ttl=64 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=40 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=41 ttl=64 time=0.019 ms
64 bytes from 127.0.0.1: icmp_seq=42 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=43 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=44 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=45 ttl=64 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=46 ttl=64 time=0.019 ms

--- 127.0.0.1 ping statistics ---
46 packets transmitted, 46 received, 0% packet loss, time 45010ms
rtt min/avg/max/mdev = 0.018/0.025/0.059/0.007 ms
 楼主| 发表于 2011-8-2 15:30:14 | 显示全部楼层
我总结一下把...
我现在添加账户都会提示添加账户失败,但是去后台查看都已经添加了...这个和我新添加的域名均无法解析有没有关系??
 楼主| 发表于 2011-8-2 15:32:07 | 显示全部楼层
我刚测试了下,我在后台添加用户也是失败...
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Archiver|URLOS ( 粤ICP备18087780号 )

GMT+8, 2025-7-7 14:24 , Processed in 0.032187 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表