S
S
Sergey Pugovkin2017-09-19 03:54:17
PHP
Sergey Pugovkin, 2017-09-19 03:54:17

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

1 answer(s)
V
Vladimir Mukovoz, 2017-09-19
@Driver86

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 question

Ask a Question

731 491 924 answers to any question