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

boyjarv's avatar

laravel application running on raspberry pi

ok so I got my laravel application running on raspberry pi, great so when I go to: http://laravel-jwt, I can see my laravel application. But when I try posting my login to POSTMAN API endpoint: http://raspberrypi/api/v1/login I get: Not Found The requested URL was not found on this server.

0 likes
28 replies
LaryAI's avatar
Level 58

The issue seems to be with the URL that is being used to access the API endpoint. It is possible that the URL is incorrect or the API endpoint is not set up properly.

To resolve this issue, try the following steps:

  1. Check the URL: Make sure that the URL being used to access the API endpoint is correct. Double-check the spelling and make sure that the URL is pointing to the correct location.

  2. Check the API endpoint: Make sure that the API endpoint is set up properly and is accessible. Check the route and controller to ensure that they are set up correctly.

  3. Check the server configuration: Make sure that the server configuration is set up correctly. Check the web server configuration file to ensure that the API endpoint is properly configured.

  4. Check the firewall: Make sure that the firewall is not blocking the API endpoint. Check the firewall configuration to ensure that the API endpoint is allowed.

If none of the above steps work, try posting the login request to the API endpoint using a different tool or client to see if the issue is with POSTMAN.

Example code:

// Sample code to check the API endpoint using PHP

$url = 'http://raspberrypi/api/v1/login';
$data = array('username' => 'user', 'password' => 'password');

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

if ($result === FALSE) { 
    // Handle error
}

// Handle response
Snapey's avatar

You have stated two different URLs in your question..... which is it?

boyjarv's avatar

so yeah, 404, the URL is the main things thats changed, would'e thought I'd just change that in postman and it should work but no?!

Snapey's avatar

@boyjarv if you are using virtual host on your web server then its important that you use the right URL. It must match the hostname provided in the .cnf file - you can't use alternate addresses just because they evaluate to the same IP

boyjarv's avatar

@Snapey <VirtualHost *:80> ServerName raspberrypi DocumentRoot /var/www/html/laravel-jwt/public LimitInternalRecursion 100 <Directory /var/www/html/laravel-jwt/public> # ... other directives ... </Directory>

# ... other configuration ...
Snapey's avatar

@boyjarv did you change thus from laravel-jwt? Have you reloaded apache since changing it?

Snapey's avatar

check that you don't have a folder called 'api'

newbie360's avatar

@boyjarv with this route, are you sending a GET request, not a POST request

Route::get('/test', function () {
    return 'Hello, this is a test route!';
});
Sensetivity's avatar

You can check the routes by command php artisan route:list It will show you correct routes for Api, if you have some.

boyjarv's avatar

the routes are there! the problem isn't with Laravel, its getting to my endpoints now my app is on my raspberry pi

boyjarv's avatar

the application is not serving on artisan, I'm just pointing to it here:

<VirtualHost *:80>
    ServerName raspberrypi
    DocumentRoot /var/www/html/laravel-jwt/public
    LimitInternalRecursion 100          
    <Directory /var/www/html/laravel-jwt/public>
        # ... other directives ...
    </Directory>

    # ... other configuration ...
</VirtualHost>
Snapey's avatar

Is it a laravel 404 page or an apache 404 ?

boyjarv's avatar

not sure how to tell the difference

boyjarv's avatar

its a laravel 404 page, NOT apache

newbie360's avatar

@boyjarv Only paste this into api.php

Route::get('/test', function () {
    return 'Hello, this is a test route!';
});

and then

php artisan route:list --path=test

if you can't see the route, clear the route cache

Please or to participate in this conversation.