Answer the question
In order to leave comments, you need to log in
How to serve php file through nginx?
location = /file.php {
# Что тут прописать,
# что бы файл file.php отдавался на скачивание,
# а не выполнялся?
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_index index.php;
try_files $fastcgi_script_name =404;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
Answer the question
In order to leave comments, you need to log in
You don't need to write anything there, or you can still add something. The very presence of a separate location in which the transfer of php to the backend is not registered will make the file download.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question