0

I am trying to run Wordpress on my NGinx server, however I think that something is wrong because the index.php file keeps downloading rather than being run.

here is my sites-available:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

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

    server_name your_domain.com;

    location / {
            # try_files $uri $uri/ =404;
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    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/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }
}

I checked to make sure that I had php7.1-fpm running and that my nginx was running as well. Both checked out to be just fine.

What am I missing?

Thanks

DevShadow
  • 759
  • 2
  • 8
  • 27
  • This post may help https://stackoverflow.com/questions/25591040/nginx-serves-php-files-as-downloads-instead-of-executing-them – Jared Chu Jun 14 '17 at 02:34
  • Possible duplicate of [Nginx serves .php files as downloads, instead of executing them](https://stackoverflow.com/questions/25591040/nginx-serves-php-files-as-downloads-instead-of-executing-them) – Renjith Thankachan Jun 14 '17 at 06:27
  • @IAmBatman I tried what they said in that post, but I got the same result – DevShadow Jun 14 '17 at 13:00

1 Answers1

0

This link solved my problem. I was missing some packages that wordpress needed. After going through that guide everything worked

DevShadow
  • 759
  • 2
  • 8
  • 27