Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6025

404 page on "/" route in Laravel. Permission denied

$
0
0

I am running my Laravel application on Ubuntu in Windows 10 but when I want to access the "/" path, the browser displays a "404 Not Found" message. Currently viewing it on the localhost.

However, the nginx error logs display this message:

2024/02/28 09:16:33 [crit] 4279#4279: *2 stat() "/root/sickofmetal/public/index.php" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"

And storage/laravel.logs shows this:

[2024-02-28 08:42:42] local.ERROR: The /var/www/html/bootstrap/cache directory must be present and writable. {"exception":"[object] (Exception(code: 0): The /var/www/html/bootstrap/cache directory must be present and writable. at /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php:178)[stacktrace]

The path to my project is currently in the root folder.

The steps to start my server are as follows.

  • I use Docker so I start by opening the Docker desktop.
  • Once the container is running, I open vscode and in the terminal, I enter the container as the "root" user.
  • Then I start vite as follows: npm run dev

Currently, the browser displays a 404 message.

What I have in my server block on "/etc/nginx/sites-available/default":

server {        listen 80;        listen [::]:80 ipv6only=on;        root /sickofmetal/public;        index index.php index.html index.htm index.nginx-debian.html;        server_name localhost;        location / {                try_files $uri $uri/ /index.php?$query_string;        }        location ~ \.php$ {                try_files $uri =404;                fastcgi_split_path_info ^(.+\.php)(/.+)$;                fastcgi_pass unix:/run/php/php8.2-fpm.sock;                fastcgi_index index.php;                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                include fastcgi_params;        }        location ~ /\.(?!well-known).* {                deny all;        }}

The sudo nginx -t command tells me there is no syntax error and I also have a symlink created in sites-enabled. After restarting nginx, the problem continues.

I have tried to use my IP in the server block, for example:

server {       listen 80;       listen 10x.32.22.xx;}

But that doesn't work. Here's my nginx. conf.

user www-data;worker_processes auto;pid /run/nginx.pid;include /etc/nginx/modules-enabled/*.conf;events {        worker_connections 768;        # multi_accept on;}HTTP {        ##        # Basic Settings        ##        sendfile on;        tcp_nopush on;        types_hash_max_size 2048;        # server_tokens off;        # server_names_hash_bucket_size 64;        # server_name_in_redirect off;        include /etc/nginx/mime.types;        default_type application/octet-stream;        ##        # SSL Settings        ##        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE        ssl_prefer_server_ciphers on;        ##        # Logging Settings        ##        access_log /var/log/nginx/access.log;        error_log /var/log/nginx/error.log;        ##        # Gzip Settings        ##        gzip on;        # gzip_vary on;        # gzip_proxied any;        # gzip_comp_level 6;        # gzip_buffers 16 8k;        # gzip_http_version 1.1;        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;        ##        # Virtual Host Configs        ##        include /etc/nginx/conf.d/*.conf;        include /etc/nginx/sites-enabled/*;}

According to the log error I posted at the beginning, the permission for opening "index.php" was denied. Checking permissions for this file on the terminal outputs the following:

4 -rw-r--r-- 1 www-data root 1710 Jun 19 2023 sickofmetal/public/index.php

I tried changing the permissions to this file like this: chmod 644 sickofmetal/public/index.php restarting the server, but the problem persists.

I would like to know my options. Am I doing something wrong on the permission side? I would like to be able to access "index.php" from my browser but I don't know what else to try. What are other options to consider? Should I just redo the docker container and start from scratch? And please, if that's the case point me to a Laravel guide for Windows 10 if that's possible. Thanks.

Laravel Version: 10.28.0

PHP Version: 8.2.7

Docker Version: 4.24.2

Browser: Firefox


Viewing all articles
Browse latest Browse all 6025

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>