Question

Help with image access

  • Posted August 16, 2018
  • Nginx

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.

Subscribe
Share

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