图像的URI不正确



我在Drupal 8上有一个网站,带有以下模块:

https://www.drupal.org/project/pwa

当我将网站的徽标加载到PWA模块的浓度中时,URI不正确(域名有2倍(:

https://www.example.com/fr/admin/config/system/example.com/sites/default/files/pwa/logo-petit-512x512l.png

通常看起来像:

https://www.example.com/sites/default/files/pwa/logo-petit-512x512l.png

如果我备份服务器并在dev.example.com子域上还原,则可以工作。

由于我没有更改配置中的任何内容,所以我真的看不到问题的来源。

你有轨道吗?谢谢你

https://www.example.com

https://i.stack.imgur.com/jlrxa.png

Drupal配置:

https://pastebin.com/qc4fvyqw

nginx配置:

server {
    listen 80 default_server;
    listen [::]:80;
    server_name example.com www.example.com;
    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /var/www/letsencrypt;
    }
    location / {
        return 301 https://www.example.com$request_uri;
    }
}
server {
    listen 443 default_server ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com;
    root /var/www/www-example-com/web;
    index index.php;
    ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "no-referrer-when-downgrade" always;
    add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
    brotli on;
    brotli_comp_level 6;
    brotli_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
    expires 1209600s;
    location ~ ^/sites/.*/files/(css|js)/optimized {
        add_header Cache-Control 'public, max-age=31536000, immutable';
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    location ~* .(txt|log)$ {
        deny all;
    }
    location ~ ..*/.*.php$ {
        return 403;
    }
    location ~ ^/sites/.*/private/ {
        return 403;
    }
    location ~ ^/sites/[^/]+/files/.*.php$ {
        deny all;
    }
    location ~* ^/.well-known/ {
        allow all;
    }
    location ~ (^|/). {
        return 403;
    }
    location / {
        try_files $uri /index.php?$query_string;
    }
    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }
    location ~ /vendor/.*.php$ {
        deny all;
        return 404;
    }
    location ~ '.php$|^/update.php' {
        expires off;
        fastcgi_split_path_info ^(.+?.php)(|/.*)$;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
    location ~ ^/sites/.*/files/styles/ {
        try_files $uri @rewrite;
    }
    location ~ ^(/[a-z-]+)?/system/files/ {
        try_files $uri /index.php?$query_string;
    }
    location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        try_files $uri @rewrite;
        expires max;
        log_not_found off;
    }
}
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com;
    ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "no-referrer-when-downgrade" always;
    add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    location / {
        return 301 https://www.example.com$request_uri;
    }
}

https://dev.example.com

https://i.stack.imgur.com/5vlcu.png

Drupal配置:

https://pastebin.com/zx0cusm4

nginx配置:

server {
    listen 80 default_server;
    listen [::]:80;
    server_name dev.example.com;
    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /var/www/letsencrypt;
    }
    location / {
        return 301 https://dev.example.com$request_uri;
    }
}
server {
    listen 443 default_server ssl http2;
    listen [::]:443 ssl http2;
    server_name dev.example.com;
    root /var/www/www-example-com/web;
    index index.php;
    ssl_certificate /etc/letsencrypt/live/dev.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/dev.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "no-referrer-when-downgrade" always;
    add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
    brotli on;
    brotli_comp_level 6;
    brotli_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
    expires 1209600s;
    location ~ ^/sites/.*/files/(css|js)/optimized {
        add_header Cache-Control 'public, max-age=31536000, immutable';
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    location ~* .(txt|log)$ {
        deny all;
    }
    location ~ ..*/.*.php$ {
        return 403;
    }
    location ~ ^/sites/.*/private/ {
        return 403;
    }
    location ~ ^/sites/[^/]+/files/.*.php$ {
        deny all;
    }
    location ~* ^/.well-known/ {
        allow all;
    }
    location ~ (^|/). {
        return 403;
    }
    location / {
        try_files $uri /index.php?$query_string;
    }
    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }
    location ~ /vendor/.*.php$ {
        deny all;
        return 404;
    }
    location ~ '.php$|^/update.php' {
        expires off;
        fastcgi_split_path_info ^(.+?.php)(|/.*)$;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
    location ~ ^/sites/.*/files/styles/ {
        try_files $uri @rewrite;
    }
    location ~ ^(/[a-z-]+)?/system/files/ {
        try_files $uri /index.php?$query_string;
    }
    location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        try_files $uri @rewrite;
        expires max;
        log_not_found off;
    }
}

检查您的Drupal站点文件系统。您可以在那里调试

/admin/config/media/file-system

最新更新