freescout icon indicating copy to clipboard operation
freescout copied to clipboard

FreeScout attachements are not working after server migration

Open SecteurA opened this issue 1 year ago • 5 comments

Hello,

We have migrate the FreeScout server, everything is working just fine, except file attachements, we can not see or download them, any hep please ?

Thank you

SecteurA avatar Aug 21 '24 17:08 SecteurA

Here is the content of filesystems.php and nginx configuration :

`<?php

return [

/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/

'default' => env('FILESYSTEM_DRIVER', 'local'),

/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/

'cloud' => env('FILESYSTEM_CLOUD', 's3'),

/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/

'disks' => [

    'local' => [
        'driver'     => 'local',
        'root'       => storage_path('app/public'),
        'url'        => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    'public' => [
        'driver'     => 'local',
        'root'       => storage_path('app/public'),
        'url'        => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    // To store file in the storage/app folder
    'private' => [
        'driver'     => 'local',
        'root'       => storage_path('app'),
        'url'        => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key'    => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
    ],

],

]; server {

server_name subdomain.mydomain.dummy;

root /var/www/html/public;

index index.php index.html index.htm;

error_log /var/www/html/storage/logs/web-server.log;

# Max. attachment size.
# It must be also set in PHP.ini via "upload_max_filesize" and "post_max_size" directives.
client_max_body_size 20M;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
# Uncomment this location if you want to improve attachments downloading speed.
# Also make sure to set APP_DOWNLOAD_ATTACHMENTS_VIA=nginx in the .env file.
location ^~ /storage/app/attachment/ {
    internal;
    alias /var/www/html/storage/app/attachment/;
}
location ~* ^/storage/attachment/ {
    expires 1M;
    access_log off;
    try_files $uri $uri/ /index.php?$query_string;
}
location ~* ^/(?:css|js)/.*\.(?:css|js)$ {
    expires 2d;
    access_log off;
    add_header Cache-Control "public, must-revalidate";
}
#  The list should be in sync with /storage/app/public/uploads/.htaccess and /config/app.php
location ~* ^/storage/.*\.((?!(jpg|jpeg|jfif|pjpeg|pjp|apng|bmp|gif|ico|cur|png|tif|tiff|webp|pdf|txt|diff|patch|json|mp3|wav|ogg|wma)).)*$ {
   add_header Content-disposition "attachment; filename=$2";
   default_type application/octet-stream;
}
location ~* ^/(?:css|fonts|img|installer|js|modules|[^\\\]+\..*)$ {
    expires 1M;
    access_log off;
    add_header Cache-Control "public";
}
location ~ /\. {
    deny  all;
}

`

SecteurA avatar Aug 21 '24 21:08 SecteurA

Hello, is there any one who can help please ?

SecteurA avatar Aug 23 '24 15:08 SecteurA

https://github.com/freescout-help-desk/freescout/wiki/Installation-Guide#11-troubleshooting

freescout-help avatar Aug 23 '24 17:08 freescout-help

i don't understand, but after 24 hours it works again for the new attachement,

The old one path was : storage/attachment/8/9/1/photo2.png?id=MY-ID&token=MY-TOKEN

and after 2 days i did a test and attachements are back working without touching any thing in the server, and the path has changed :

storage/attachment/3/7/1/photo3.png?id=MY-ID&token=MY-TOKEN

It would be great if you just tell me what is the reason for this.

Thank you,

SecteurA avatar Aug 24 '24 00:08 SecteurA

Have you followed Troubleshooting guide? Have you checked logs?

freescout-help avatar Aug 24 '24 04:08 freescout-help