nginx serves some (but not all) php files as downloads nginx serves some (but not all) php files as downloads wordpress wordpress

nginx serves some (but not all) php files as downloads


For running Wordpress behind Nginx, this works for me:

    location / {            # try_files $uri $uri/ =404;            try_files $uri $uri/ /index.php?q=$uri&$args;    }    location /wp-content/updraft {      deny all;    }    error_page 404 /404.html;    error_page 500 502 503 504 /50x.html;    location = /50x.html {            root /usr/share/nginx/html;    }    location ~ \.php$ {            try_files $uri =404;            fastcgi_split_path_info ^(.+\.php)(/.+)$;            fastcgi_pass unix:/var/run/php5-fpm.sock;            fastcgi_index index.php;            include fastcgi_params;    }

I also recommend reviewing the sample files from the Wordpress-Nginx project. In particular, you may also be interested the globals/restrictions.conf file, which hardens your installation somewhat. If you have several Wordpress sites on the same server, they can all share these "global" configuration files, making your life as a Wordpress admin easier.