Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7069

Issue with uploading images and videos in next.js with nginx

$
0
0

I'm currently facing an issue with uploading images and videos in my Next.js application hosted on a VPS. Despite modifying the permissions for the necessary directories, I'm still unable to upload any media files. Here are the details of my setup:nextjs 14, nginx, PM2 and VPS Ubuntu

I have set the permissions for the public directory:

sudo chown -R ubuntu:ubuntu /var/www/nextjs/Project/publicsudo chmod -R 755 /var/www/nextjs/Project/public

nginx configuration:

server {    listen 80;    server_name (mydomain);    client_max_body_size 100M;    location / {        proxy_pass http://127.0.0.1:3000;        proxy_http_version 1.1;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection 'upgrade';        proxy_set_header Host $host;        proxy_cache_bypass $http_upgrade;    }    location /_next/static/ {        alias /var/www/nextjs/Project/.next/static/;    expires 365d;        access_log off;    }    location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {       access_log off;       log_not_found off;       expires 365d;       add_header Cache-Control "public, max-age=31536000, immutable";    }    location /recipe_img/ {        alias /var/www/nextjs/Project/public/recipe_img/;        access_log off;        expires max;    }    location /tips_img/ {        alias /var/www/nextjs/Project/public/tips_img/;        access_log off;        expires max;    }    location /recipe_video/ {        alias /var/www/nextjs/Project/public/recipe_video/;        access_log off;        expires max;    }    location /tips_video/ {        alias /var/www/nextjs/Project/public/tips_video/;        access_log off;        expires max;    }}

And when I run:

pm2 logs

I got:

pm2 logs error

And when I run:

sudo tail -f /var/log/nginx/error.log

I got:

nginx/error

Could anyone provide insights or suggestions on what else I might be missing or need to check? Any help would be greatly appreciated!


Viewing all articles
Browse latest Browse all 7069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>