Got 403 forbidden when I want serve it by Nginx
Unanswered
White-crowned Pigeon posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
White-crowned PigeonOP
I have Netjs project on our local gitlab, I clone this project on my linux desktop and run this command
'''yarn build'''
after that move .next to
'''/usr/share/nginx/html/call'''
after that I make this for ngnix server
'''server {
listen 10007;
#server_name testnextdeploy.com www.testnextdeploy.com;
root /usr/share/nginx/html/call-center;
location / {
try_files $uri $uri/ /_next/$uri /index.html;
}
location /_next {
alias /usr/share/nginx/html/call-center/.next;
try_files $uri $uri/;
}
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
'''
and after that restart nginx
but when I go to browser and type 192.168.1.90:10007
I got this error
'''403 Forbidden / nginx/1.14.1
'''
and I see this in error log of nginx
'''
2023/09/09 10:00:21 [error] 889200#0: *1 directory index of "/usr/share/nginx/html/call/" is forbidden, client: 1.2.3.4, server: , request: "GET / HTTP/1.1", host: "192.168.1.90:10007"
2023/09/09 10:00:22 [error] 889200#0: *1 directory index of "/usr/share/nginx/html/call/" is forbidden, client: 1.2.3.4, server: , request: "GET / HTTP/1.1", host: "192.168.1.90:10007"
'''
and nginx can not serve this nextjs project.
permission of files and folder of nextjs project serve by nginx is OK , I have another projects on this server and all of them serve by nginx without problem.
'''yarn build'''
after that move .next to
'''/usr/share/nginx/html/call'''
after that I make this for ngnix server
'''server {
listen 10007;
#server_name testnextdeploy.com www.testnextdeploy.com;
root /usr/share/nginx/html/call-center;
location / {
try_files $uri $uri/ /_next/$uri /index.html;
}
location /_next {
alias /usr/share/nginx/html/call-center/.next;
try_files $uri $uri/;
}
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
'''
and after that restart nginx
but when I go to browser and type 192.168.1.90:10007
I got this error
'''403 Forbidden / nginx/1.14.1
'''
and I see this in error log of nginx
'''
2023/09/09 10:00:21 [error] 889200#0: *1 directory index of "/usr/share/nginx/html/call/" is forbidden, client: 1.2.3.4, server: , request: "GET / HTTP/1.1", host: "192.168.1.90:10007"
2023/09/09 10:00:22 [error] 889200#0: *1 directory index of "/usr/share/nginx/html/call/" is forbidden, client: 1.2.3.4, server: , request: "GET / HTTP/1.1", host: "192.168.1.90:10007"
'''
and nginx can not serve this nextjs project.
permission of files and folder of nextjs project serve by nginx is OK , I have another projects on this server and all of them serve by nginx without problem.
4 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Havana
I'm having the same issue and NOBODY will help.
![Avatar](https://cdn.discordapp.com/avatars/574128504451366913/c7a4adfef2358c8419f2de11728c5e01.webp?size=256)
iyxan23
could be better if you open up a new thread with details, i'll try to help 👍
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Havana
Thanks @iyxan23 you are a legend.
I’ll open a new thread again.