NGINX downloads text file instead of displaying it
- by Hoang Lam
I have Nginx installed with the following nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
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 /vagrant/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
Everytime I tried the URL of any text files (not PHP, it works fine), the browser asks to download it.
Common measure such as disabling default-type octet/stream fails.