Answer the question
In order to leave comments, you need to log in
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
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.
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 questionAsk a Question
731 491 924 answers to any question