Linking to a text file could force the browser to download the file instead of parsing the files content to the browser window.

With nginx and Apache it’s easy to force the browser to show the content directly, this could be very useful. The trick is to add the text/plain content-type.

The examples below will add Content-Type text/plain to the header for .js, .sh and .txt files.

nginx configuration inside the server { } configuration block:

location ~* ^.+\.(js|sh|txt)$ {
	add_header Content-Type text/plain;

Apache requires mod_mime (should be installed/activated by default!). You could add this line to your .htaccess or in the httpd.conf:

AddType text/plain .js .sh .txt