Serving static files with NGINX
Vložit
- čas přidán 12. 09. 2024
- Learn how to serve static files with NGINX, while delegating API calls to Node.js
------------------
Deploying Node playlist:
• Deploying Node
IMPORTANT
------------------
From 2018 and on, the setup in this video will only work if your SELinux is configured correctly (to allow nginx to connect to Node and to read files from home folder). Otherwise you will be getting "Not Found" and "Permission Denied" errors.
Check out this video if that's what you are experiencing:
• Understanding and Conf...
IMPORTANT
------------------
From 2018 and on, the setup in this video will only work if your SELinux is configured correctly (to allow nginx to connect to Node and to read files from home folder). Otherwise you will be getting "Not Found" and "Permission Denied" errors.
Check out this video if that's what you are experiencing:
czcams.com/video/HhydNtaLEK0/video.html
this type of how to videos are now my new fantasies . :)
YOU SAVED MY ASS BUDDY. It's been 3 days I was unable to run my nginx server on docker because of right management that's sick !
Eelke Johnson glad it helped! :)
Can't thank you enough man. Great Video!
Exactly what I was looking for, and worked perfectly. Thanks!
Hey there it also helped me deploy my Django application
This is really really good. Thanks very much!! I encountered the permission issue and tried nginx_conf/user/group/selinux/ all not working finally with your "namei" command found one folder did not give 'x' permission. It works now. :)
Great video. You're showing great details in both nginx & node.js .. thabk you!
This saved me a ton of time. Thanks
Thanks Jury you saved me today thanks I like your videos
chown: invalid group: ‘sohel:nginx’ . Here sohel is my user
Great video, can you help me with some tip? i have multiples locations where each on have a nodejs application, so i need setup multiples statics path
I have a noob quetion, so in the case
here
our nginx would be storing the files ?
if I am dockerized and my Nginx is a seperate docker/phisical-server then files host on that server ?
That’s great work me.
Sorry, I cannot reach the static page even if I start an independant server listening on 8080. The error is always 404.
Very good tutorial
Thanks you very much this ..
Love it! :D
What is the benefit of serving static files using nginx? What if I wanted to serve the home route using express, but still serve other static files using nginx?
Speed!
Я так понимаю нужно все запросы в node делать /api/some_req
Тоесть я не могу тепер делать /some_req. Иначе он попадет к nginx. А тот его не обработает?
I had one problem while following your tutorial. The thing is that you must also do: "chmod -R g+x /path/to/public/folder" and/or "chmod -R u+x /path/to/public/folder" to enable executing of this files. Because if your user (which is defined in nginx "user" directory nginx.org/en/docs/ngx_core_module.html#user ) won't have the rights to execute the files in your public folder it won't work.
Why would you want to "execute" files in the public folder? You have only to be able to "read" them. X is required to "cd" into the folder, which we did for user's home directory.
in my fedora it doesn't work. When I set correct permissions I was still getting NOT PERMITED. I had to also disabled my SELinux in
nano /etc/selinux/config
SELINUX=disabled
and now works good. thanks for video :)
I run into the same issue. Disabling SELinux worked, but it didn't feel right. Why did we have to go through configuring SELinux in the first place?
The answer was that I needed to set:
chcon -Rt httpd_sys_content_t /home/USERNAME/easyio/public
as indicated in the video about Understanding and Configuring SELinux.
Juriy need your help. How to serve dynamic index.html on rout "/" if nginx grabs this and try to give static file first.
How to serve dynamic index with static css in public folder. Index.html is not in public folder its dynamic. That's the question.
I don't quite get your setup. So your index.html is not there, since it is served by node.js? And what's nginx then serving?
I working on a new project now and it seems it's working fine now. I believe it was my mistake. Thank You for such awesome content
why you put there api/test?,
To simulate some kind of API that is available under that route.
Русский)
Сертификат обнови дядя