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.