我一直在研究和阅读通过网络搜索呈现给我的几乎所有内容。它似乎很容易,我无法解决这种痛苦。
我让负载均衡器检查来自AWS中所有节点的健康检查200OK
响应。所以在nginx conf(/etc/nginx/conf.d/ssl.conf
)中,我将以下条目作为位置块
location /about {
root /usr/share/nginx/html;
add_header X-Frame-Options "DENY";
try_files $uri /about.htm;
}
文件/usr/share/nginx/html/about.htm
存在。因此,想法是当某人在https://server_name/about
上进行GET时,将显示文件/usr/share/nginx/html/about.htm
的内容。它正在与nginx 1.0.15合作,我升级到nginx version: nginx/1.8.0
,从那时起它就开始了。 nginx的错误日志显示以下无限循环
2015/10/09 23:20:24 [error] 25078#0: *308 rewrite or internal redirection cycle while internally redirecting to "/about.html", client: 10.22.32.108, server: server_name, request: "GET /about HTTP/1.1", host: "10.22.32.72"
由于此URL(.... / about)失败,运行状况检查失败,因此没有流量发送到此节点。
任何建议??
答案 0 :(得分:0)
我在nginx&中看到了许多与try_files
指令相关的问题。每个人都有这个刺的独特问题。所以,我在/etc/nginx/conf.d
viz default.conf
下有2个nginx配置文件 - 其中包含HTTP流量和ssl.conf
的配置文件 - 它们具有HTTPS流量的配置。在我的例子中,/etc/nginx/conf.d/default.conf
配置为将任何HTTP请求重定向到HTTPS,/etc/nginx/conf.d/ssl.conf
负责HTTPS事务。
从nginx.org repo安装nginx 1.8之后(我在nelx 1.0.15上,EPEL repo中提供.EPEL没有更高版本,这很糟糕!我现在需要为nginx修改我的Chef配方)。 http://server_name/about
& https://server_name/about
开始破裂。
以下是安装1.8之前的原始配置文件(仅限相关位置块i,e /about
)
default.conf & ssl.conf
具有与此位置相同的配置/about
location /about {
add_header X-Frame-Options "DENY";
try_files $uri /about.html;
}
所以,对于1.8版本,我必须像这样改变(两个文件中的 )
location /about {
root /usr/share/nginx/html;
add_header X-Frame-Options "DENY";
try_files $uri /about.html;
}
注意root
,nginx 1.8似乎期望nginx的$ ROOT_DIRECTORY。以下是该指令所说的per nginx
Checks the existence of files in the specified order and uses the first found file for request processing; the processing is performed in the current context. The path to a file is constructed from the file parameter according to the root and alias directives.
因此,在/etc/nginx/conf.d/ssl.conf
中设置后,根本指令未在/etc/nginx/conf.d/default.conf
中设置。