若依前后端分离版,图片上传后无法显示问题

若依前后端分离版,部署时通常会采用Nginx做反向代理。访问图片出现404 Not Found问题。

若依在文件上传成功后,请求访问后台地址会根据profile进行匹配,需要自己配置代理。

配置方式一:使用后端资源映射,此方式需要在Springboot项目内配置资源映射。

    # 静态资源配置方式一
    location /profile/ {
        client_max_body_size 10000m;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://localhost:8088/profile/;
    }

配置方式二:使用Nginx Alias

    location /profile/ {
    # 静态资源配置方式二:指向目录,对应后台`application.yml`中的`profile`配置目录一致
      alias /home/admin/app/attachments/;
    }

建议使用配置二。

如果这样配置了还不能访问,检查你的Nginx配置文件,注掉或删掉下述配置。

    # location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
         expires      30d;
         error_log off;
         access_log /dev/null;
    }
    
    # location ~ .*\.(js|css)?$
     {
         expires      12h;
         error_log off;
         access_log /dev/null; 
     }

### PostgreSQL 14.6 Binary Installation Guide For users preferring or requiring a binary installation of PostgreSQL 14.6, the process involves downloading precompiled binaries and setting up the environment appropriately without needing to compile from source code[^1]. The following sections outline this procedure. #### Downloading Binaries Precompiled binaries can be obtained directly from official repositories maintained by PostgreSQL Global Development Group or third-party providers that offer packages suitable for various operating systems including Windows, macOS, and Linux distributions. For direct downloads, visiting the official website provides links tailored specifically towards different platforms ensuring compatibility with hardware architectures like x86_64. #### Installing on Windows On Windows, after acquiring the installer executable file: - Run the downloaded `.exe` as an administrator. - Follow the setup wizard instructions which include selecting components (server, client tools), specifying directories where files will reside, configuring service settings such as port number and authentication method, and initializing the database cluster automatically during installation. ```powershell # Example command line initialization post-installation if needed "C:\Program Files\PostgreSQL\14\bin\initdb.exe" -D "C:\Program Files\PostgreSQL\14\data" ``` #### Setting Up Environment Variables To facilitate easier management and execution of commands related to PostgreSQL once installed via binaries, updating system PATH variable is recommended so that `psql`, `pg_ctl`, among others are accessible globally within terminal sessions: ```batchfile setx PATH "%PATH%;C:\Program Files\PostgreSQL\14\bin" ``` #### Verifying Successful Installation After completing these steps, verifying successful deployment becomes straightforward through invoking psql utility interactively or executing simple queries against local server instance using command-line interface provided alongside other utilities included in binary package distribution. ```bash psql --version psql -U postgres -c "SELECT version();" ``` --related questions-- 1. What are some common issues encountered while installing PostgreSQL binaries? 2. How does one configure security settings effectively post-binary installation of PostgreSQL? 3. Can you provide guidance on migrating databases when upgrading between major versions of PostgreSQL? 4. Is there any difference in performance tuning considerations between source-built versus binary-installed instances?
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值