tail -f /var/log/nginx/error.log
2013/05/04 23:43:35 [error] 733#0: *3662 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: _, request: "GET /robots.txt HTTP/1.1", host: "kowol.mysite.net"
HTTP/1.1", host: "www.joesfitness.net"
2013/05/05 00:49:14 [error] 733#0: *3783 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: _, request: "GET / http://www.qq.com/ HTTP/1.1", host: "www.qq.com"
2013/05/05 03:12:33 [error] 733#0: *4232 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "joesfitness.net"
Run Code Online (Sandbox Code Playgroud)
我从 nginx 错误日志中获取这些信息,我没有“kowol”子域,我的网站上没有任何指向 qq.com 或 joesfitness.net 的链接。这是怎么回事?
编辑:Nginx 默认配置:
server {
listen 8080; ## listen for ipv4; this line is default and implied
listen [::]:8080 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an error code
#return 418;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/www;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
#With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Run Code Online (Sandbox Code Playgroud)
Mic*_*ton 105
好吧,这是一个奇怪的问题,尽管我敢打赌问题在于:
try_files $uri $uri/ /index.html;
Run Code Online (Sandbox Code Playgroud)
这里的问题是这里的第二个参数$uri/, 会导致index依次尝试指令中的每个文件。如果没有找到,它然后移动到/index.html,这会导致location重新进入相同的块,因为它仍然不存在,你会得到一个无限循环。
我会把它改写为:
try_files $uri $uri/ =404;
Run Code Online (Sandbox Code Playgroud)
如果您在index指令中指定的索引文件都不存在,则返回 404 错误。
顺便说一句,您看到的那些请求是互联网背景噪音。特别是,它们是用于确定您的 Web 服务器是否是开放代理的探针,并且可以在恶意用户执行恶意活动时被滥用以隐藏其来源。在此配置中,您的服务器不是开放代理,因此您无需担心。
小智 9
这很烦人。几周前它可以工作,但当我今天尝试时却失败了。
我相信 Ubuntunginx软件包的升级会导致 Ubuntu 保存标准索引文件的默认目录发生变化,因此该行:
root /usr/share/nginx/www;
Run Code Online (Sandbox Code Playgroud)
由于文件的位置在/usr/share/nginx/html.
要修复,只需将根指针更改为正确的目录,或创建指向新目录的符号链接:
cd /usr/share/nginx
sudo ln -s html www
Run Code Online (Sandbox Code Playgroud)
为我工作。
| 归档时间: |
|
| 查看次数: |
151016 次 |
| 最近记录: |