Welcome! Log In Create A New Profile

Advanced

Got 403 forbidden when I want serve Nextjs project by Nginx

September 09, 2023 08:56AM
I have Nextjs project on our local gitlab, I clone this project on my linux desktop and run this command
[code ] yarn build [/code]
after that move .next to
[code] /usr/share/nginx/html/call [/code]
after that I make this for ngnix server
[code]
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;
}
[/code]
and after that restart nginx

but when I go to browser and type 192.168.1.90:10007

I got this error
[code]403 Forbidden / nginx/1.14.1 [/code]

and I see this in error log of nginx
[code]
den, 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"
[/code]

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.
Subject Author Posted

Got 403 forbidden when I want serve Nextjs project by Nginx

mfaridi September 09, 2023 08:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 147
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready