Search your config files for Content-Disposition . If you see a line like the one below, it will force a download regardless of the file type:

If this is happening with .php files, NGINX is likely handing the file directly to the browser rather than passing it to a PHP processor like .

Troubleshooting: Why NGINX is Downloading PHP/HTML Files Instead of Serving Them

Check your /etc/nginx/nginx.conf file. It should look like this:

http { include /etc/nginx/mime.types; default_type application/octet-stream; ... } Use code with caution.

Most "download instead of serve" issues are solved by ensuring the mime.types are loaded and that the PHP location block is correctly routing to the active PHP socket.