NGINX downloads text file instead of displaying it

Posted by Hoang Lam on Server Fault See other posts from Server Fault or by Hoang Lam
Published on 2014-05-29T09:06:11Z Indexed on 2014/05/29 9:29 UTC
Read the original article Hit count: 244

Filed under:
|

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.

© Server Fault or respective owner

Related posts about nginx

Related posts about mime-type