The original post: /r/nginx by /u/LavaBoy5890 on 2024-07-12 20:26:33.
I have my React project hosted on EC2 with Nginx as the proxy. I also have GitHub actions set up, which seems to work. The main problem is that I can’t seem to serve images. I can serve images locally (I use Vite for my local dev server if that helps) but when the project is hosted, it only serves everything except pictures. I can’t seem to serve .jpg or .svg, even though these are both configured correctly in mime.types and mime.types is included in nginx.conf. My config file in sites-enabled looks like this:
I am not sure if I need both location contexts since the React project is referring to the image’s correct location in server and should already be pulling the image from there, but I figured I would try. I’m just not really sure what’s wrong; when I go into the console there are no errors. I’ve ran nginx -t and looked at error files; nothing. In the dev tools under Network I see that my picture name is present; it’s just not showing up on the page (instead I get a default icon). Notably under the Network tab in dev tools it’s saying that my pic has a type of “text/html” rather than “jpeg”. If anyone could help I’d appreciate it.