Nginx 无法提供带有正确标题的图像(提供示例 + 配置)

Nginx 无法提供带有正确标题的图像(提供示例 + 配置)

以下是错误提供的图像的示例:

https://www.questionhosting.com/product/temp.jpg

这是我的配置

server {
    listen   80;
    listen   443 ssl;
    listen   [::]:80 default ipv6only=on;
    listen   [::]:443 ssl ipv6only=on;

    server_name questionhosting.com;
    ssl_certificate     /etc/nginx/ssl/ssl.crt;
    ssl_certificate_key /etc/nginx/ssl/ssl.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    root /var/www/public;
    index index.php index.html index.htm;

    # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
    sendfile off;

    # Add stdout logging
#    error_log /dev/stdout info;
#    access_log /dev/stdout;
    error_log  /var/log/nginx/error.log warn;
    access_log  /var/log/nginx/access.log main;

    # Add option for x-forward-for (real ip when behind elb)
    #real_ip_header X-Forwarded-For;
    #set_real_ip_from 172.16.0.0/12;

    # Hide ALL kind of hidden stuff.
    location ~ /\. {
        return 403;
    }

    # Direct deliver certain files
    location ^~ ^\/(template|plugin|product|block|module).+\.(css|js|jpeg|gif|png|jpg){
        include /etc/nginx/mime.types;
        access_log      off;
        add_header      Cache-Control   "public";
        add_header      Pragma          "public";
        expires         30d;
        log_not_found   off;
        tcp_nodelay     off;
        try_files       $uri =404;
    }

    location / {
        include /etc/nginx/mime.types;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_read_timeout 1200;
        include fastcgi_params;
#        fastcgi_pass fpm;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
#        fastcgi_pass 127.0.0.1:9000;
#        fastcgi_pass cryptoweighter.questiondevelopment.com:9000;



        # First attempt to serve file, then as directory, then fall back to routing by the main index.php file
        try_files $uri $uri/ /index.php?$query_string;
    }
}

我的目标是直接加载仅驻留在特定文件夹中的特定文件扩展名。我希望将其余请求发送到 /var/www/public/index.php 并由该文件处理。此配置在我的另一台服务器上有效,但当我将其移到这里时,它停止了。任何帮助都将不胜感激。

相关内容