我有一个运行nginx的SSL域,我想能够访问我的munin图/统计在该域。 所以,在域的server块中,我添加了这个:
location = /munin/ { alias /var/cache/munin/www/; }
理论上,我应该可以访问http://example.com/munin并显示/var/cache/munin/www/index.html 。 但是,我得到一个500错误,并在error.log这个消息:
2011/08/26 15:21:25 [错误] 19089#0:* 31218重写或内部redirect周期内部redirect到“/index.html”,客户端:1.2.3.4,服务器:domain.com,请求:“ GET / munin / HTTP / 1.1“,主机:”domain.com“
我尝试了一堆不同的东西,但似乎没有任何工作。 如果有人能够澄清这种情况,我会很感激,也许会想出一个解决scheme。 谢谢! :)
这是域的完整configuration,如果有帮助:
server { listen 443 default ssl; ## listen for ipv6 ssl_certificate somewhere; ssl_certificate_key somewhere; root /srv/www/domain.com/wwwroot; index index.html index.htm index.php; access_log /srv/www/domain.com/logs/access.log combined; error_log /srv/www/domain.com/logs/error.log; server_name example.com; 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 127.0.0.1:9000 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 server_name example.com; rewrite ^(.*) https://domain.com$1 permanent; }
你为什么使用location = ? 我相当肯定,这不是你想要的。 另一方面,这应该不会导致你的redirect循环,据我所知,但它肯定不会帮助你得到你想要的。 启用nginxdebugging( error_log ... debug或error_log ... debug_http如果您有一个正确的nginx)来查看nginx对您的请求在内部做了什么,它应该给你一个线索,如何解决它。