X-Accel-Redirect mode not work on Nginx


#1

Hi all.

I move my site from host’s Apache to new host’s Nginx. Everything working well except X-Accell-Redirect/X-Sendfile mode in Woocommerce setting.

My site use Woocommerce 2.1.1, Amazon S3 download 1.4. We allow user download files from Amazon S3 but we dont want user know url or where we storage files.
When i set “Force download” mode on Woocommerce setting, it’s ok but slow speed. But when i set “X-Accell-Redirect” … file downloaded with 10kb while it’s 1,2Gb.

Please help me slove this problem, setting correct nginx config.

Thanks in advanced.
Best regards.


#2

@commandofide
please give us following details
nginx configuration, download link when you set force download and amazon s3 download link for testing.


#3

Here is my nginx config.

user  nginx;  
worker_processes  2;  

error_log  /var/log/nginx/error.log warn;  
pid        /var/run/nginx.pid;  

events {  
    worker_connections  1024;  
}  

http {  
    include       /etc/nginx/mime.types;  
    default_type  application/octet-stream;  

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
                      '$status $body_bytes_sent "$http_referer" '  
                      '"$http_user_agent" "$http_x_forwarded_for"';  

    access_log  /var/log/nginx/access.log  main;  

    sendfile        on;  
    #tcp_nopush     on;  

    keepalive_timeout  65;  

    gzip  on;  

    include /etc/nginx/conf.d/*.conf;  
	server_names_hash_bucket_size 128;  
	server {  
		server_name myservername.com www.myservername.com;  
		listen 172.29.56.193;  
		root /home/myservername/public_html;  
		index index.html index.htm index.php;  
		access_log /var/log/virtualmin/myservername.com_access_log;  
		error_log /var/log/virtualmin/myservername.com_error_log;  
		fastcgi_param GATEWAY_INTERFACE CGI/1.1;  
		fastcgi_param SERVER_SOFTWARE nginx;  
		fastcgi_param QUERY_STRING $query_string;  
		fastcgi_param REQUEST_METHOD $request_method;  
		fastcgi_param CONTENT_TYPE $content_type;  
		fastcgi_param CONTENT_LENGTH $content_length;  
		fastcgi_param SCRIPT_FILENAME /home/myservername/public_html$fastcgi_script_name;  
		fastcgi_param SCRIPT_NAME $fastcgi_script_name;  
		fastcgi_param REQUEST_URI $request_uri;  
		fastcgi_param DOCUMENT_URI $document_uri;  
		fastcgi_param DOCUMENT_ROOT /home/myservername/public_html;  
		fastcgi_param SERVER_PROTOCOL $server_protocol;  
		fastcgi_param REMOTE_ADDR $remote_addr;  
		fastcgi_param REMOTE_PORT $remote_port;  
		fastcgi_param SERVER_ADDR $server_addr;  
		fastcgi_param SERVER_PORT $server_port;  
		fastcgi_param SERVER_NAME $server_name;  
                client_max_body_size 128M;  
                client_body_buffer_size 128k;  
		location ~ \.php$ {  
			try_files $uri =404;  
			fastcgi_pass unix:/var/php-nginx/14030019919613.sock/socket;  
		}  
	       if (!-e $request_filename) {  
		rewrite ^.*$ /index.php last;  
	       }  
	}  
}

Private file with Accesskey
http://eumov.s3.amazonaws.com/woocommerce.zip?AWSAccessKeyId=AKIAIY2VAAWR7CBKR7OA&Expires=1403081629&Signature=llQS4yHa4MnJifWnJ%2BWuyVn9%2Bvg%3D

Or
File is public
http://eumov.s3.amazonaws.com/woocommerce.zip


#4

@ commandofide1807,

Sorry for this late reply.
Can we get the server login details for above config debug?


#5