Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm removing extensions from uploaded files in my CMS. If the file is an image, the thumbnail has JPG extension but the original file is extensionless. Example:

http://gazi.edu.tr/upload/26/2012/10/9/2f97e51581606b2dd606faf82cd4ce9ff784e87f-small.jpg
http://gazi.edu.tr/upload/26/2012/10/9/2f97e51581606b2dd606faf82cd4ce9ff784e87f

The problem is, nginx serves the thumbnail very fast. But the original file is waiting for minutes.

Here is my full config file:

server {
        #listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www/public;
        index index.html index.php index.htm;

        # Make site accessible from http://localhost/
        server_name _;


        client_max_body_size    25m;


        if ($host = 'www.gazi.edu.tr' ) {
                rewrite  ^/(.*)$  http://gazi.edu.tr/$1  permanent;
        }

        location / {

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

                #if (!-e $request_filename) {
                #       rewrite ^.*$ /index.php last;
                #}

        }

        location = /robots.txt  { access_log off; log_not_found off; }
        location = /favicon.ico { access_log off; log_not_found off; }

        location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
                access_log        off;
                log_not_found     off;
                expires           max;
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";

        }

                location ~ /\. {
                access_log off;
                log_not_found off;
                deny all;
        }


        location ~* ^/upload/.*.php$ {
                deny all;
                access_log off;
                log_not_found off;
        }

        location ~* ^/upload/.* {
                access_log off;
                log_not_found off;
                expires max;
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        }



        location /doc/ {
                alias /usr/share/doc;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }


        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php(.*)$ {
                try_files $uri =404;
                location ~ \..*/.*\.php$ {return 404;}

                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini


                #fastcgi_pass 127.0.0.1:9000;
                #fastcgi_pass unix:/tmp/php5-fpm.sock;
                fastcgi_index index.php;

                #fastcgi_connect_timeout 60;
                #fastcgi_send_timeout 180;
                #fastcgi_read_timeout 180;
                #fastcgi_buffer_size 128k;
                #fastcgi_buffers 256 16k;
                #fastcgi_busy_buffers_size 256k;
                #fastcgi_temp_file_write_size 256k;
                fastcgi_intercept_errors on;
                #fastcgi_max_temp_file_size 0;

                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param APPLICATION_ENV production;

                include fastcgi_params;

                #if ($request_uri ~* ^/admin) {
                #       return 301 http://gazi.edu.tr/admin
                #}


                fastcgi_pass admincluster;
                proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;



        }

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

I need to find out why the file without extension is downloading too slow, or even not downloading?

thanks in advance.

share|improve this question
full config file added. – Cnkt Oct 15 '12 at 13:17
@Cnkt Michael wanted to know why you remove the file extensions from your files. I want to know it too. – ppeterka Oct 15 '12 at 13:32
i'm just explained it but ok, i'm explaining it again: "the files in the /upload folder are user-uploaded files like pdfs, jpegs etc. nginx serves the files very fast if it has extension (first link in question), but it waits too much if the file has no extension (second link in question). i'm trying to find out why it waits, or even not serving the file." thanks, again for all your effort but i can't understand why you are angry (or upset). i'm trying to answer all your questions. – Cnkt Oct 15 '12 at 13:33
1  
Phrased another way, "Files without extension take a very long time to download, but files with extensions download fast. Why is this?" – sysadmin1138 Oct 15 '12 at 13:34
now i see :) thanks, @ppeterka. It was a security-feature implemented before i was in charge of this CMS and i'cant just change the files because this CMS is in production for 3 years and hundreds of thousand files are in /uplaod folder already. – Cnkt Oct 15 '12 at 13:35
show 2 more comments

closed as too localized by Michael Hampton, Adrian, Ward, Brent Pabst, Scott Pack Oct 18 '12 at 17:18

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.