Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
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"

I am getting these from nginx error log, I don't have a "kowol" sub domain, I don't have any links to qq.com or joesfitness.net on my site. Whats going on?

Edit: Nginx default config:

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;
    #}
}
share|improve this question
    
Post a copy of the relevant server block. –  Michael Hampton May 5 '13 at 5:11
    
you mean from nginx config? –  pavs-maha May 5 '13 at 5:11
    
Of course, what else? –  Michael Hampton May 5 '13 at 5:17
    
Added. I am new to nginx so wasn't very obvious to me. :) –  pavs-maha May 5 '13 at 5:19
add comment

1 Answer

up vote 11 down vote accepted

It's a strange one all right, though I'm going to bet the problem is with:

        try_files $uri $uri/ /index.html;

The problem here is that the second parameter here, $uri/, causes each of the files in your index directive to be tried in turn. If none are found, it then moves on to /index.html, which causes the same location block to be re-entered, and since it still doesn't exist, you get an endless loop.

I would rewrite this as:

        try_files $uri $uri/ =404;

to return a 404 error if none of the index files you specified in the index directive exist.


BTW, those requests you are seeing are Internet background noise. In particular, they are probes to determine whether your web server is an open proxy and can be abused to hide a malicious user's origin when he goes to perform malicious activity. Your server isn't an open proxy in this configuration, so you don't really need to worry about it.

share|improve this answer
    
Thanks for the explanation. Is there any way one could block/ban these kind of probes? –  pavs-maha May 5 '13 at 5:28
    
Not really, just feed them a nice 404 and they'll figure it out eventually. –  Michael Hampton May 5 '13 at 5:29
    
Thanks I am going to use your suggestion. –  pavs-maha May 5 '13 at 5:30
    
What's "funny" is that default config on ubuntu 13.10 has try_files $uri $uri/ /index.html; and index index.php index.html index.htm; set. resulting in the error in the question. Not so for 12.04 and 14.04, so less likely to happen on a server. –  leifcr Apr 3 at 8:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.