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

tapas's avatar
Level 15

Laravel in sundirectory returning 404 - Not Found

I tried to install Laravel in subdirectory in Docker. Although the root domain is working fine, the laravel installation in subdirectory giving 404 - Not Found. Here is the nginx config file. I guess I didn't set up the nginx perfectly. I appreciate if you help. Thanks.

server {
    listen 80;
    client_max_body_size 120M;
    index index.php index.html;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass app:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_read_timeout 180;
    }
    
    location / {
        try_files $uri $uri/ /index.php?$query_string;
        gzip_static on;
    }
    
    location /laravel {
        root /var/www/laravel/public;
        try_files $uri $uri/ /laravel/public/index.php?$query_string;
    }
} 
0 likes
1 reply

Please or to participate in this conversation.