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
server {
listen 10007;
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

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

and I see this in error log of nginx
den, client:, server: , request: "GET / HTTP/1.1", host: ""
2023/09/09 10:00:22 [error] 889200#0: *1 directory index of "/usr/share/nginx/html/call/" is forbidden, client:, server: , request: "GET / HTTP/1.1", host: ""

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: 116
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready