gpt4 book ai didi

php - Nginx - 将 PHP 视为二进制文件

转载 作者:行者123 更新时间:2023-12-04 07:06:31 24 4
gpt4 key购买 nike

我们正在运行 Nginx+FastCgi 作为我们 Drupal 站点的后端。
一切似乎都很好,除了这个网址。
http:///sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/smimage/index.php

(我们在 Drupal 中使用 TinyMCE 模块,上面的 url 调用时
用户尝试上传图片)

当我们使用 Apache 时,一切正常。
但是,nginx 会处理上面的 url Binary 并尝试下载它。
(我们已经验证了 url 指向的文件是一个有效的 PHP 文件)

知道这里可能有什么问题吗?

我认为这与 NGINX 配置有关,但不完全确定那是什么。

任何帮助是极大的赞赏。

配置:
这是来自 nginx 配置文件的片段:

      root /var/www/;
index index.php;

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

error_page 404 index.php;
location ~*
\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$
{
deny all;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 7d;
}

location ~* ^.+\.(css|js)$ {
access_log off;
expires 7d;
}

location ~ .php$ {
include /etc/nginx/fcgi.conf;
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}

location ~ /\.ht {
deny all;
}

最佳答案

做了

location ~ \.php$ {

代替
location ~ .php$ {

关于php - Nginx - 将 PHP 视为二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1041315/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com