[英]The requested resource / was not found on this server
I have created a Laravel Framework 5.5.22
project on c9
.我在
c9
上创建了一个Laravel Framework 5.5.22
项目。 I am using the php version:我正在使用 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
When I run the php built in server I get the error No such file or directory
:当我运行内置服务器的 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
I also tested apache2:我还测试了 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.但是,在这里我只得到一个
blank
页。
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. sudo nano /etc/apache2/sites-enabled/001-cloud9.conf
并将/public
添加到第 2 行的末尾。
It looks like the following:它看起来像下面这样:
<VirtualHost *:8080>
DocumentRoot /home/ubuntu/workspace/public
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:您可以指定一个
-t
标志来告诉 PHP 从不同的文件夹运行服务器:
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!不要忘记调用
php artisan key:generate
并在需要时填写您的.env
文件!
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.
谢谢你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.