问题一:

server {  
 
 
1.         listen          80;  
2.         server_name     yq.object.home.com;  
3.         charset utf-8;  
4.         access_log      /www/logs/yq.object.home.log;  
5.         location / {  
6.                 proxy_set_header Host yq.object.com;  
7.                 proxy_set_header DFROM 'yq.object.home.com';  
8. <SPAN style="COLOR: #ff0000">  proxy_pass      http://yq.object.com:8080/object/home.php;</SPAN>
9.         }  
10. }  
 
 
server {
        listen          80;
        server_name     yq.object.home.com;
        charset utf-8;
        access_log      /www/logs/yq.object.home.log;
        location / {
                proxy_set_header Host yq.object.com;
                proxy_set_header DFROM 'yq.object.home.com';
                proxy_pass      http://yq.object.com:8080/object/home.php;
        }
}利用nginx进行反向代理的时候,我们会配置proxy_pass。在启动nginx的时候,会报
nginx: [emerg] host not found in upstream "yq.object.com" in /usr/local/nginx/conf/vhost/yq.nginx.com.conf:19 这个错误。
其实nginx配置语法上没有错误的,只是系统无法解析这个域名,所以报错.
解决办法就是添加dns到/etc/resolv.conf 或者是/etc/hosts,让其能够解析到IP。具体步骤如下:vim /etc/hosts
修改hosts文件,在hosts文件里面加上一句
127.0.0.1       localhost.localdomain   yq.object.com
 
其实 这和windows下的hosts文件的修改是一样的。具体可以去了解一下hosts的作用
 
 
 
问题二:
 
 
  
1. nginx: [emerg] host not found in upstream "11.lum"
2. Nginx 启动成功! Nginx was started successfully.  
 
  
上面错误为nginx未启动,点启动时提示上面语句。 
  
类似这告诉的错误,解决方案 
  

点左侧 网站(虚拟主机) => 编辑 任何一个网站 => 不用改什么 直接保存 => 在去启动nginx 启动成功后 在去编辑任何一个网站,不用改什么直接保存 => ok
 
问题三:如果重启服务器后,Nginx为启动,在后台手动启动Nginx报下面的错误
 
 
  
1. Shutting down php_fpm Starting php_fpm done nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 128 nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or
2. Nginx重启失败! Nginx was restarted failed.  
 
  
 
解决方法,登录ssh,把/usr/local/nginx/conf/nginx.conf 文件里这一行的数值修改下
 
  

    原来的是: 
  
 
  

    server_names_hash_bucket_size 128; 
  
 
  

    改成: 
  
 
  

    server_names_hash_bucket_size 512; 
   

如果自己手工修改过网站伪静态的,这块也检查下,有的时候也可能是网站伪静态的问题,删除之前的伪静态在启动,也可以解决问题。 
   
  

      
  
 
  

    问题四: 
  
 
  
在执行nginx命令时,出现了 windows nginx: [error] CreateFile() "logs/nginx.pid" failed 异常。原因是未指定
nginx.conf,指定该文件,启动命令如下:
D:\tools\nginx-1.6.1>nginx -c D:\tools\nginx-1.6.1\conf\nginx.conf

nginx错误日志如何查看 nginx错误代码_nginx


问题二:

 



  1. nginx: [emerg] host not found in upstream "11.lum"
  2. Nginx 启动成功! Nginx was started successfully.  



上面错误为nginx未启动,点启动时提示上面语句。


类似这告诉的错误,解决方案



点左侧 网站(虚拟主机) => 编辑 任何一个网站 => 不用改什么 直接保存 => 在去启动nginx 启动成功后 在去编辑任何一个网站,不用改什么直接保存 => ok

 

问题三:如果重启服务器后,Nginx为启动,在后台手动启动Nginx报下面的错误

 

1. Shutting down php_fpm Starting php_fpm done nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 128 nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or
2. Nginx重启失败! Nginx was restarted failed.


 

解决方法,登录ssh,把/usr/local/nginx/conf/nginx.conf 文件里这一行的数值修改下



原来的是:


server_names_hash_bucket_size 128; 
  
 
  

    改成: 
  
 
  

    server_names_hash_bucket_size 512;



如果自己手工修改过网站伪静态的,这块也检查下,有的时候也可能是网站伪静态的问题,删除之前的伪静态在启动,也可以解决问题。



 



问题四:


在执行nginx命令时,出现了 windows nginx: [error] CreateFile() "logs/nginx.pid" failed 异常。原因是未指定
nginx.conf,指定该文件,启动命令如下:
D:\tools\nginx-1.6.1>nginx -c D:\tools\nginx-1.6.1\conf\nginx.conf

nginx错误日志如何查看 nginx错误代码_nginx