PDF file not showing or downloading in nginx server -
i've been searching day, not founding solution. here's problem: vm running ubuntu nginx server php apps. application works fine except cant see or download pdf files in browser.
i'll try describe of configuration me solve problem:
nginx 1.6.2 php 5.5.26
my /etc/nginx/nginx.conf:
user www-data; worker_processes 1; worker_rlimit_nofile 1024; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; server_tokens on; types_hash_max_size 1024; types_hash_bucket_size 512; server_names_hash_bucket_size 64; server_names_hash_max_size 512; keepalive_timeout 65; tcp_nodelay on; gzip on; gzip_disable "msie [1-6]\.(?!.*sv1)"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
my /etc/nginx/sites-available/app.conf:
server { listen 80; server_name app.dev; client_max_body_size 1m; root /_dev/www/app.com.br/public_html; index index.html index.htm index.php; charset utf-8; access_log /etc/nginx/www.access.log; error_log /etc/nginx/www.error.log; location / { root /_dev/www/app.com.br/public_html; try_files $uri $uri/ index.php; index index.html index.htm index.php; } location ~ \.php$ { root /_dev/www/app.com.br/public_html; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; try_files $uri $uri/ index.php /index.php$is_args$args; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param script_filename $request_filename; fastcgi_param app_env dev; } location ~* (.*\.pdf) { types { application/octet-stream .pdf; } default_type application/octet-stream; } sendfile off; }
when click button triggers script pdf file response headers are:
cache-control:private, must-revalidate, post-check=0, pre-check=0, max-age=1 connection:keep-alive content-description:file transfer content-disposition:attachment; filename="romaneio.pdf" content-transfer-encoding:binary content-type:application/pdf date:thu, 18 jun 2015 21:59:18 gmt expires:sat, 26 jul 1997 05:00:00 gmt last-modified:thu, 18 jun 2015 21:59:18 gmt pragma:public server:nginx/1.6.2 transfer-encoding:chunked
but browser doesn't open or download it. can ? thank !
edit: console log took ajax response shows bunch of stuff, seems pdf file code, why reason browser doesn't open or download ?
edit 2: well, after thorough research found tcpdf doesn't work ajax calls, idea on pdf library allows ajax calls ?
Comments
Post a Comment