It’s been 3 days I’m facing an issue on my nginx that always got an error 403 forbidden once I opening my static file on my website.
I’ve tried googling with these keywords, but still got no solution:
The only one clue that I had from nginx logs is only “permission denied”.
$ sudo tail -f /var/log/nginx/error.log $ 2016/02/13 08:27:23 [error] 19693#0: *14 open() "/root/projects/portofolio/static/admin/css/base.css" failed (13: Permission denied), client: 36.xx.xxx.xx, server: 128.xxx.xxx.xxx, request: "GET /static/admin/css/base.css HTTP/1.1", host: "128.xxx.xxx.xxx"
I have tried to change my project permission, my static file permission, user that execute my nginx and permission denied still appear. I have asked to some of my friends one of them told me that I have to check my “nginx.conf“.
At that time, I thought I need to check file permission, but I think that I misunderstanding with my friend suggestion. Then I checked my “nginx.conf” and yeahhh!! I just know that “nginx.conf” had user config that we have to set.
By default “nginx.conf” user is “www-data“.
user www-data; worker_processes 4; pid /run/nginx.pid;
Then I replaced with my VPS user and solved my problem. 😀
user my_user; worker_processes 4; pid /run/nginx.pid;
I’ve got really really good experience at this first deploying app.
Stupid, eh? 😀