Nginx and php-fpm downloading php file instead of executing

I am faberblasted. maybe someone can find why this doesn't work.

Using Nginx 1.10.0 and trying to install Worpress with pagespeed on my experimental server ubuntu 16.04


user  henri:www-data;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/;

events {
    worker_connections  1024;

http {
    include       mime.types;

#    default_type  application/octet-stream;
     default_type text/html;
    #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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;


nano /etc/nginx/sites-available/default

server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

        root /var/www/;
        index index.php index.html index.htm;

#       server_name localhost;

        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;

        location / {
                 try_files $uri $uri/ /index.php$is_args$args;

 location ~ \.php$ {

        fastcgi_pass unix:/var/run/php7-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

in my /etc/php/7.0/fpm/pool.d/www.conf

listen = /var/run/php7-fpm.sock;

The socket is present in the respective directory.

I tried:

  1. Emptying my browser cache
  2. restarting server/nginx/php-fpm

ps aux | grep php-fpm

root      4593  0.0  0.7 362588 30592 ?        Ss   22:50   0:00 php-fpm: master process (/etc/php/7.0/fpm/php-fp.conf)
henri     4595  0.0  0.1 362588  6124 ?        S    22:50   0:00 php-fpm: pool www
henri     4596  0.0  0.1 362588  6124 ?        S    22:50   0:00 php-fpm: pool www
henri     4769  0.0  0.0  14224   968 pts/0    R+   23:15   0:00 grep --color=auto php-fpm

Nothing unusual in my php7.0-fpm.log/Nginx error.log/access.log

File is still downloading instead of executing. What am I missing?


OK that was sooooooooo stupid!!!! Hopefullyy this won't happen to anyone else! I was configuring the wrong nginx file all along!!!!

I got that by typing nginx -V (uppercase V)... it will give you the correct path for all your nginx file... please don't presume that the file you are working on is the correct one!



 ? ZF3 correct place to put your api keys
 ? Phing execute error : Fatal error: require_once(): Failed opening required
 ? Magento: why is not working even though "frontName" is turned to product-vragen?
 ? PyMongo on the Flask
 ? Mapping Nested Config Yaml to struct
 ? Docker Rails Production Logging
 ? How do I specify that I want my jsp-config directive to apply to all JSP pages served in our application?
 ? Can I add commands with Go flags?
 ? Management of AWS resources Configuration
 ? Telegraf test input and output plugins error multiple conf files