P
P
Petr Volkhanov2014-02-19 00:49:02
Nginx
Petr Volkhanov, 2014-02-19 00:49:02

Why does Nginx offer to download a file when trying to open localhost/test.php?

Installed nginx server, it works. But if I type localhost/test.php, it doesn't open the file, but offers to download it. How to solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dan Ivanov, 2014-02-19
@ptchol

nginx and should not open it.
All dynamic requests should be directed to someone who can interpret this code (php-fpm \ apache with php module).
Show the nginx config, the problem will become clearer.

S
Sergey Meketyuk, 2014-02-19
@SergeiMeketyuk

You probably have the block "location ~ .php$" commented out in the config file, if so, uncomment it.
Just do not copy this one, it may not be the same as yours.

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /var/www/nginx-default$fastcgi_script_name;
    include        fastcgi_params;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question