Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

carlo's avatar
Level 2

Directory index of... is forbidden

Hello, I'm trying to put back online an old Laravel project.

A few weeks ago I finished upgrading Laravel to version 9 and managed to make it work locally. Now, when I try to deploy the website on a DigitalOcean server I get this error:

*262025 directory index of "/var/www/example.com/" is forbidden, client: 77.11.170.172, server: example.com, request: "GET / HTTP/1.1", host: "www.example.com

Some technical details: Server: Ubuntu 20.04 with Nginx

Nginx configuration file:

server {
            listen 80;
            listen [::]:80;

        server_name example.com www.example.com;
        root /var/www/example.com/public;
        index index.php index.html;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                include fastcgi_params;
                fastcgi_pass unix:/run/php/php8.2-fpm.sock;
                fastcgi_param SCRIPT_FILENAME /var/www/example.com$fastcgi_script_name;
                fastcgi_param PHP_VALUE post_max_size=100M;
                fastcgi_param PHP_VALUE upload_max_filesize=100M;
        }

When I try to open the url I simply get the error "File not found"

Can you help me figuring out what's wrong?

0 likes
0 replies

Please or to participate in this conversation.