Report this

What is the reason for this report?

Help with image access

Posted on August 16, 2018

Hello,

I’m struggling with an issue for more than 2 weeks.

I have an nginx and pm2 setup. The issue is when I upload a file,

I can’t access the image through a url like http://[ip]/static/uploads/2018/08/articles/1/image.jpg

In some weird scenarios I can see the image uploaded, but in most cases I don’t. If I try to open the image in the browser it redirects to the defaul url.

I’ve checked that the image is saved in the right path. I’ve also checked nginx and pm2 error log files and they are clean.

I suppose I should configure in nginx a path for static files, but not sure how.

The nginx config for sites-available default is

root /root/app/app1.com/dist;

server_name [ip];

location / {
    try_files $uri $uri/ /index.html;
}

Any help is appreciated,

Thanks.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.