Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an SSL domain that runs nginx, and I want to be able to access my munin graphs/stats on that domain. So, in the domain's server block, I added this:

    location = /munin/ {
            alias /var/cache/munin/www/;

Theoretically, I should be able to go to and be shown /var/cache/munin/www/index.html. However, I get a 500 error, and this message in error.log:

2011/08/26 15:21:25 [error] 19089#0: *31218 rewrite or internal redirection cycle while internal redirect to "/index.html", client:, server:, request: "GET /munin/ HTTP/1.1", host: ""

I've tried a bunch of different things, but nothing seems to work. I'd be really grateful if somebody could shed some light on this situation, and maybe come up with a solution. Thanks! :)

Here is the full configuration for the domain, if it helps:

server {

        listen 443 default ssl; ## listen for ipv6
        ssl_certificate         somewhere;
        ssl_certificate_key     somewhere;

        root /srv/www/;
        index index.html index.htm index.php;
        access_log /srv/www/ combined;
        error_log /srv/www/;


        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;

        error_page 404 /404.html;
        error_page 403 /403.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

        location ~ \.php$ {
                fastcgi_param HTTPS on;
                include fastcgi_params;

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one

        location ~ /\.ht {
                deny all;

        location = /favicon.ico {
                log_not_found off;
                access_log off;

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;

        location = /munin/ {
                alias /var/cache/munin/www/;

server {

        listen [::]:80; ## listen for ipv6
        rewrite ^(.*)$1 permanent;
share|improve this question
up vote 2 down vote accepted

Why are you using location =? I'm fairly certain that isn't what you want. On the other hand, that shouldn't be causing your redirect loop, as I understand it, but it certainly won't be helping you get what you want. Enable nginx debugging (error_log ... debug or error_log ... debug_http if you've got an nginx built correctly) to see what nginx is doing to your request internally, and it should give you a clue as to how to fix it.

share|improve this answer
On your advice, I changed it to location ^~ /munin/, but I'm still getting the redirect loop. I'll enable debugging and see what happens – squircle Aug 27 '11 at 1:48
Whoops; forgot to reload the configuration. Thanks for the fix! :) – squircle Aug 27 '11 at 1:58
No, location ^~ /munin/ is wrong too. A straight location /munin will work just fine. – womble Aug 27 '11 at 3:21
Thanks, changed and it works fine. :) – squircle Aug 27 '11 at 15:49

Your Answer


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.