网站停止显示图像(显示损坏的图像链接)。
有两个事实:
- 这些图像的路径是正确的
- 请求网址:https://www.example.tld/?image=yAZiOJXRVwCGEVG8.png&size=big(应该是这样)
但是,如果我将此链接复制到 Web 浏览器,在 Mozilla 的情况下,我会看到“无法显示图像”链接到图像“因为它包含错误”。
事实三:
- 如果我在 apache2 (背面和正面)下的 localhost 上启动该网站的副本,图像将正确显示。所以这就是为什么我倾向于认为问题出在 nginx 的某个地方。
事实四:
- 其他信息(例如也来自后端的文本)在那里并且很好。
有什么建议么?
UPD。新闻展示代码(每条新闻都有图片)
<?php
$datalayer = new \DataLayer\DataLayer();
$page = array_key_exists('page', $parameters) ? $parameters['page'] : 1;
$count = array_key_exists('count', $parameters) ? $parameters['count'] : 8;
$request = new \DataLayer\Main\Requests\GetNews($page, $count);
$type = array_key_exists('type', $parameters) ? $parameters['type'] : 'horizontal';
$news = $datalayer->processRequest('getNews', $request)['data'];
?>
<div class="news8 <?=($news->Page == $news->TotalPages ? " last" : "")?>">
<?php foreach($news->News as $key => $row): ?>
<a class="container" href="/?news=<?=$row->Id?>">
<img class="header-image" src="<?=($row->Image ? './?image='.$row->Image.'&size=preview' : './media/imgs/ico-no-img.png')?>" />
<div class="news-info">
<div class="news-header"><?=$row->Title?></div>
<div class="news-date"><?=date ("d.m.Y", time($row->Created))?></div>
</div>
</a>
<?php endforeach; ?>
配置
ssl.conf
#
# HTTPS server configuration
#
server {
listen 443 ssl http2 default_server;
server_name www.hostname.example;
root /path/to/root;
index index.php index.html;
ssl_certificate hostname_example.crt;
ssl_certificate_key hostname_example.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
fastcgi_cache portalName;
fastcgi_cache_valid 200 301 302 304 60m;
fastcgi_cache_key "$request_method$http_if_modified_since$http_if_none_match$host$request_uri";
fastcgi_pass_header "X-Accel-Expires";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
fastcgi_param HTTP_X_REAL_IP $remote_addr;
include fastcgi_params;
}
}