user2945758
user2945758

Reputation:

NGINX server is downloading php files

i'm trying to setup nginx on my vps and i made it however when i'm try to use .php files it download then instead of runing them. This is my nginx.conf

server {
     listen 80;
     server_name site;
     root /var/www/;
     index index.php index.html;
}

Any ideas how to fix it? (i have php5-fpm installed)

Upvotes: 0

Views: 246

Answers (2)

Slava Rozhnev
Slava Rozhnev

Reputation: 10163

For pass the PHP scripts to FastCGI you must add this into server config:

    location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;

            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
    }

Upvotes: 2

SomniusX
SomniusX

Reputation: 83

You really need to enable php-cgi/fast-cgi or -cli depending on your server/vps configuration.

share with us more information to be able to help you (like config files etc.)

Upvotes: 0

Related Questions