This was really annoying and now i see when it happens. If <ip>/NAME
exist in /var/www (/var/www/NAME
) nginx will give me a redirect to www._.com/NAME/
(note the slash and lack of url) which is annoying and just wrong. If the url ends with a /
it will check the index and serve index.html
How do i either make it give me an error page or add a /
to the end of it?
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name _;
access_log /var/log/nginx/localhost.access.log;
root /var/www;
location / {
root /var/www;
index index.php index.html index.htm;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
}