在此服务器上找不到请求的资源 /
The requested resource / was not found on this server
我在 c9
上创建了一个 Laravel Framework 5.5.22
项目。我正在使用 php 版本:
$ 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
当我 运行 php 内置服务器时,我得到错误 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
我也测试了apache2:
$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built: Sep 18 2017 16:37:54
然而,在这里我只返回了一个 blank
页面。
对我做错了什么有什么建议吗?
感谢您的回复!
更新
我设置:
sudo nano /etc/apache2/sites-enabled/001-cloud9.conf
并在第 2 行的末尾添加 /public
。
看起来像这样:
<VirtualHost *:8080>
DocumentRoot /home/ubuntu/workspace/public
当您启动内置服务器时,它看起来像是在项目根目录中 运行ning。您可以指定一个 -t
标志来告诉 PHP 到 运行 来自不同文件夹的服务器:
php -S 0.0.0.0:8080 -t public/
如果需要,请不要忘记致电 php artisan key:generate
并填写您的 .env
文件!
此错误是由于没有找到正确的资源folder/file。您必须确保在启动服务器时位于存储项目的正确目录中。所以解决方案是:
cd your/folder/project
然后
php -S localhost:8080 -t public/
希望对您有所帮助。谢谢。
我在 c9
上创建了一个 Laravel Framework 5.5.22
项目。我正在使用 php 版本:
$ 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
当我 运行 php 内置服务器时,我得到错误 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
我也测试了apache2:
$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built: Sep 18 2017 16:37:54
然而,在这里我只返回了一个 blank
页面。
对我做错了什么有什么建议吗?
感谢您的回复!
更新
我设置:
sudo nano /etc/apache2/sites-enabled/001-cloud9.conf
并在第 2 行的末尾添加 /public
。
看起来像这样:
<VirtualHost *:8080>
DocumentRoot /home/ubuntu/workspace/public
当您启动内置服务器时,它看起来像是在项目根目录中 运行ning。您可以指定一个 -t
标志来告诉 PHP 到 运行 来自不同文件夹的服务器:
php -S 0.0.0.0:8080 -t public/
如果需要,请不要忘记致电 php artisan key:generate
并填写您的 .env
文件!
此错误是由于没有找到正确的资源folder/file。您必须确保在启动服务器时位于存储项目的正确目录中。所以解决方案是:
cd your/folder/project
然后
php -S localhost:8080 -t public/
希望对您有所帮助。谢谢。