Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The requested resource / was not found on this server

I have created a Laravel Framework 5.5.22 project on c9. I am using the php version:

$ php --version
PHP 7.0.25-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Oct 27 2017 14:07:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.25-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

When I run the php built in server I get the error No such file or directory:

Starting PHP built-in web server, serving https://projet-laravel-testuser.c9users.io/.
PHP 7.0.25-1+ubuntu14.04.1+deb.sury.org+1 Development Server started at Thu Nov 30 17:36:08 2017
Listening on http://0.0.0.0:8080
Document root is /home/ubuntu/workspace
Press Ctrl-C to quit.
[Thu Nov 30 17:36:16 2017] 10.240.0.100:38766 [404]: / - No such file or directory

I also tested apache2:

$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Sep 18 2017 16:37:54

However, here I only get a blank page back.

Any suggestions what I am doing wrong?

I appreciate your replies!

UPDATE

I set:

sudo nano /etc/apache2/sites-enabled/001-cloud9.conf and added /public to the end of line 2.

It looks like the following:

<VirtualHost *:8080>
    DocumentRoot /home/ubuntu/workspace/public
like image 412
Carol.Kar Avatar asked Jan 03 '23 03:01

Carol.Kar


2 Answers

When you start up the built-in server, it looks like it's running in the project root. You can specify a -t flag to tell PHP to run the server from a different folder:

php -S 0.0.0.0:8080 -t public/

Don't forget to call php artisan key:generate and to fill out your .env file if needed!

like image 135
Chris Forrence Avatar answered Jan 07 '23 19:01

Chris Forrence


This error is due to not finding the right resource folder/file. You have to make sure that when you start server you are on the right directory where the project was stored. So the solution is:

cd your/folder/project

and then

php -S localhost:8080 -t public/

Hope it helps. Thank you.

like image 27
azwar_akbar Avatar answered Jan 07 '23 18:01

azwar_akbar