Strange directory behaviour: rename causes 404 error

Xan nginx-forum at nginx.us
Fri Sep 2 20:32:32 UTC 2011


Hi,

I have strange behaviour. I have a directory "@docencia". All is ok:

172.26.0.6 - - [02/Sep/2011:22:26:10 +0200] "GET /@docencia/ HTTP/1.1"
200 218 "https://172.26.0.3/" "Mozilla/5.0 (X11; Linux i686; rv:6.0.1)
Gecko/20100101 Firefox/6.0.1"

but when I rename to "docencia", I have:

172.26.0.6 - - [02/Sep/2011:22:27:59 +0200] "GET /docencia/ HTTP/1.1"
404 244 "https://172.26.0.3/" "Mozilla/5.0 (X11; Linux i686; rv:6.0.1)
Gecko/20100101 Firefox/6.0.1"


I don't know why. Any hint.
Please, help me.

Xan.


My nginx.conf is:
user www-data;
worker_processes  1;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    # =logs:
    access_log|_/var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    # =compressió:
    gzip  on;
    gzip_min_length 100;
    gzip_types text/plain text/css text/xml application/x-javascript
application/atom+xml;

    # =inclusió dels servidors virtuals
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

and /etc/nginx/sites-enabled/ only has default:
# You may add here your
# server {
#	...
# }
# statements for each of your virtual hosts

# Servidor pla (http).
server {
	listen   80 default;
	server_name  localhost;

	location / {
		 rewrite ^(.*)$ https://$host$1 permanent;
	}

	# Per a què no me doni error si el navegador me demana favicon.ico i
no el
	# tenc. De [http://wiki.nginx.org/Piwik]
	# location = /favicon.ico {
        #         try_files /favicon.ico =204;
        #}

	# Seguint http://wiki.nginx.org/ThttpdCGI
	#location ~ \.pl$ {
	#	#include proxy.conf;
	#	proxy_intercept_errors on;
	#	proxy_pass http://127.0.0.1:8082;
	#	proxy_redirect     off;
	#	proxy_set_header  X-Real-IP  $remote_addr;
	#	proxy_set_header        Host            $host;
	#	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

	#	#proxy_redirect  default;
	#	#real_ip_header     X-Real-IP;
	#	#proxy_set_header Connection Close;
        #   	#proxy_intercept_errors on;
	#}

        #location ~ \.php$ {
        #        #include proxy.conf;
        #        proxy_intercept_errors on;
        #        proxy_pass http://127.0.0.1:8082; #8082 --> lighttpd
        #        proxy_redirect     off;
        #        proxy_set_header  X-Real-IP  $remote_addr;
        #        proxy_set_header        Host            $host;
        #        proxy_set_header        X-Forwarded-For
$proxy_add_x_forwarded_for;

         #       #proxy_redirect  default;
         #       #real_ip_header     X-Real-IP;
         #       #proxy_set_header Connection Close;
         #       #proxy_intercept_errors on;
        #}


	# Estat de les connexions del nginx.
	# De [http://kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/]
	#location /status {
	#	stub_status on;
	#	access_log   off;
	#	allow 127.0.0.1;
        #        allow 172.26.0.0/24;
	#	deny all;
        #}


	# proxy the PHP scripts to Apache listening on 127.0.0.1:80
	#
	#location ~ \.php$ {
		#proxy_pass   http://127.0.0.1;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	#location ~ \.php$ {
		#fastcgi_pass   127.0.0.1:9000;
		#fastcgi_index  index.php;
		#fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
		#includefastcgi_params;
	#}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
		#deny  all;
	#}
}


# Servidor SSL (https)
server {
    server_name localhost;
    listen 443;

    ssl on;
    ssl_certificate /usr/local/nginx/conf/server.crt;
    ssl_certificate_key /usr/local/nginx/conf/server.key;


    location / {
    root   /var/www;
    index  index.html index.htm index.php;
    autoindex on;
    autoindex_exact_size off;
    }


    location /doc {
                root   /usr/share;
                autoindex on;
		autoindex_exact_size off;
                allow 127.0.0.1;
                allow 172.26.0.0/24;
                deny all;
    }

	# 400 = Bad request
        error_page  400  /400.html;
        location = /400.html {
                root /var/www/code-pages;
        }

        # 401 = Unauthorized
        error_page  401  /401.html;
        location = /401.html {
                root /var/www/code-pages;
        }

        # 403 = Forbidden page
        error_page  403  /403.html;
        location = /403.html {
                root /var/www/code-pages;
        }

        # 404 = Not found
        error_page  404  /404.html;
        location = /404.html {
                root /var/www/code-pages;
        }

        # 500 = Internal Server Error
        #
        error_page   500 /500.html;
        location = /500.html {
                root   /var/www/code-pages;
        }

        # 501 = Not Implemented
        #
        error_page   501 /501.html;
        location = /501.html {
                root   /var/www/code-pages;
        }


        # 502 = Bad Gateway
        #
        error_page  502 /502.html;
        location = /502.html {
                root   /var/www/code-pages;
        }

        # 503 = Service Unavaliable
        #
        error_page   503 /503.html;
        location = /503.html {
                root   /var/www/code-pages;
        }

        # 504 = Gateway Timeout
        #
        error_page   504  /504.html;
        location = /504.html {
                root   /var/www/code-pages;
        }

        # 505 = HTTP Version Not Supported
        #
        error_page   505  /505.html;
        location = /505.html {
                root   /var/www/code-pages;
        }


        # Per a què no me doni error si el navegador me demana
favicon.ico i no el
        # tenc. De [http://wiki.nginx.org/Piwik]
         location = /favicon.ico {
                 try_files /favicon.ico =204;
        }

	# Execució de scripts de perl per proxy i lighttpd
	# Informació original http://wiki.nginx.org/ThttpdCGI
        location ~ \.pl$ {
                #include proxy.conf;
                proxy_intercept_errors on;
                proxy_pass http://127.0.0.1:8082;
		#En teoria 8443; per ser segur entre servidors
                proxy_redirect     off;
                proxy_set_header  X-Real-IP  $remote_addr;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Forwarded-For
$proxy_add_x_forwarded_for;

                #proxy_redirect  default;
                #real_ip_header     X-Real-IP;
                #proxy_set_header Connection Close;
                #proxy_intercept_errors on;
        }

#	# Per executar php via fastcgi (php-fpm).
#	# NO descomentar.
#        location ~ \.php$ {
#                include /etc/nginx/fastcgi_params;
#		#fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
#		#fastcgi_param  SCRIPT_FILENAME   
$document_root$fastcgi_script_name;
#		fastcgi_pass  127.0.0.1:9000;
#        }

	# Execució de php per proxy a lighttpd
        location ~ \.php$ {
                #include proxy.conf;
                #proxy_intercept_errors on;
                proxy_pass http://127.0.0.1:8082; #8082 --> lighttpd
		##proxy_set_header X-Forwarded-Host $host;
    		##proxy_set_header X-Forwarded-Server $host;
    		##proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

                #proxy_redirect    off;
		#proxy_buffering   off;
                proxy_set_header  X-Real-IP  $remote_addr;
                proxy_set_header  Host            $host;
                proxy_set_header  X-Forwarded-For $remote_addr;
#$proxy_add_x_forwarded_for;
		#proxy_set_header  X-Forwarded-Ssl on;

                ##proxy_redirect  default;
                ##real_ip_header     X-Real-IP;
                ##proxy_set_header Connection Close;
                ##proxy_intercept_errors on;
        }

	location  /segur/ {
  		auth_basic            "Zona restringida";
		auth_basic_user_file  conf.d/contrasenyes;
                root   /var/www/;
		autoindex on;
	}

        # Estat de les connexions del nginx.
        # De
[http://kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/]
        location /status {
               stub_status on;
               access_log   off;
               allow 127.0.0.1;
               allow 172.26.0.0/24;
               deny all;
        }



}




# another virtual host using mix of IP-, name-, and port-based
configuration
#
#server {
#listen   8000;
#listen   somename:8080;
#server_name  somename  alias  another.alias;

#location / {
#root   html;
#index  index.html index.htm;
#}
#}


# HTTPS server
#
#server {
#listen   443;
#server_name  localhost;

#ssl  on;
#ssl_certificate  cert.pem;
#ssl_certificate_key  cert.key;

#ssl_session_timeout  5m;

#ssl_protocols  SSLv2 SSLv3 TLSv1;
#ssl_ciphers 
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_ciphers   on;

#location / {
#root   html;
#index  index.html index.htm;
#}
#}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,214663,214663#msg-214663



More information about the nginx mailing list