无法显示 Laravel 欢迎页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30576341/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot Get Laravel Welcome Page to Show
提问by aCarella
My server is on DigitalOcean cloud. I am using Ubuntu with Apache web server. My home computer is running Windows 7. I am using putty for terminal.
我的服务器在 DigitalOcean 云上。我正在将 Ubuntu 与 Apache Web 服务器一起使用。我的家用电脑运行的是 Windows 7。我正在使用腻子作为终端。
Followed all of the directions on https://laracasts.com/series/laravel-5-fundamentals/episodes/1. Made it up to 8:40, where it directs you to run php -S localhost:8888 -t public
. I run that, then open a web browser and tried the following:
-http://mywebsite.com:8888
-http://www.mywebsite.com:8888
-http://mywebsite.com/learning-laravel-5/public
-http://mywebsite.com/learning-laravel-5/public/index.php
按照https://laracasts.com/series/laravel-5-fundamentals/episodes/1上的所有说明进行操作。一直到 8:40,它会指导您运行php -S localhost:8888 -t public
. 我运行它,然后打开网络浏览器并尝试以下操作:
- http://mywebsite.com:8888
- http://www.mywebsite.com:8888
- http://mywebsite.com/learning-laravel-5 /public
- http://mywebsite.com/learning-laravel-5/public/index.php
None of the above work.
以上都不起作用。
In Google Chrome, the first two options where I list the port number, I get a page saying This webpage is not available. ERR_CONNECTION_REFUSED.
In IE, I just get a page with big font saying "This page can't be displayed."
在谷歌浏览器中,我列出端口号的前两个选项,我得到一个页面,说This webpage is not available. ERR_CONNECTION_REFUSED.
在 IE 中,我只得到一个大字体的页面,上面写着“无法显示此页面”。
For the last two options, I just get a completely blank page. In the console, I get this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
.
对于最后两个选项,我只得到一个完全空白的页面。在控制台中,我收到此错误:Failed to load resource: the server responded with a status of 500 (Internal Server Error)
.
I'm trying to pick up a web app framework to broaden my php skill set. Can someone help me out? What am I doing wrong/what is the video tutorial missing that I have to do in order to get Laravel up and running?
我正在尝试选择一个 Web 应用程序框架来扩展我的 php 技能集。有人可以帮我吗?我做错了什么/为了让 Laravel 启动和运行我必须做的视频教程缺少什么?
采纳答案by KevinD
php -S localhost:8888 -t public
is meant for running a site locally, which is what the video is showing.
php -S localhost:8888 -t public
用于在本地运行站点,这就是视频所显示的内容。
If you are using a Digital Ocean droplet with Ubuntu and Apache, you will need to configure Apache to use /public as the document root and have Laravel installed in the /var/www directory.
如果您在 Ubuntu 和 Apache 中使用 Digital Ocean Droplet,则需要将 Apache 配置为使用 /public 作为文档根目录,并将 Laravel 安装在 /var/www 目录中。
From there you can visit the droplet's IP address (http://XXX.XXX.XXX.XXX
) instead of the domain name (unless you have configured the DNS for that domain name). You won't need the port in the URL either, since Apache will be serving it on the default port 80.
从那里您可以访问 Droplet 的 IP 地址 ( http://XXX.XXX.XXX.XXX
) 而不是域名(除非您已为该域名配置了 DNS)。您也不需要 URL 中的端口,因为 Apache 将在默认端口 80 上为其提供服务。
回答by Elvn
This probably is not the answer you want, but here's my advice based on setting up a few VPSs on Digital Ocean. Step back. Spin a new VPS. Keep your old one around, if you want, but start afresh.
这可能不是您想要的答案,但这是我基于在 Digital Ocean 上设置几个 VPS 的建议。退后。旋转一个新的 VPS。如果您愿意,可以保留旧的,但要重新开始。
- Create a new droplet
- Setup your SSH and PuTTY and make sure that works
- Setup your FTP (if you're using it)
- Setup your DNS
- Setup your Apache config files. DO has a very good tutorial on this: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
- Now, work on getting your "Hello world" html page to show when you access your domain www.yourdomain.com, yourdomian.com. Don't fixate on ports at this point, just get a minimal server running. This might help too: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
- Make an saved "image" of this basic working setup so you can spin a new VPS if you need to.
- Now that you have a server that loads your domain index page, you can start to install your Laravel.
- 创建一个新的液滴
- 设置您的 SSH 和 PuTTY 并确保其有效
- 设置您的 FTP(如果您正在使用它)
- 设置您的 DNS
- 设置您的 Apache 配置文件。DO 有一个非常好的教程:https: //www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
- 现在,努力让您的“Hello world”html 页面在您访问您的域 www.yourdomain.com、yourdomian.com 时显示。此时不要专注于端口,只需运行一个最小的服务器即可。这也可能有帮助:https: //www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
- 制作此基本工作设置的保存“图像”,以便您可以在需要时旋转新的 VPS。
- 现在你有一个加载域索引页面的服务器,你可以开始安装你的 Laravel。
In a nutshell, I'd advise you to establish a stable working server platform before you try to install and launch a more complex technology like Laravel, or Rails, etc.
简而言之,我建议您在尝试安装和启动更复杂的技术(如 Laravel 或 Rails 等)之前,先建立一个稳定的工作服务器平台。
Tutorials often make complex technologies seem easy, the 10-minute expert, but there is tremendous complexity masked under the hood of these frameworks. Start simple and build on a server one piece at a time. You have to walk before you run.
教程通常使复杂的技术看起来很容易,10 分钟专家,但在这些框架的引擎盖下隐藏着巨大的复杂性。从简单开始,一次一个地在服务器上构建。在跑步之前,你必须先走路。
回答by Styphon
I use Laravel often, but my experience with servers is more relevant here. Everything you've said indicates an access problem, and knowing how hosting companies work, they probably have that port blocked (along with all other non-standard ports).
我经常使用 Laravel,但我在服务器方面的经验在这里更重要。您所说的一切都表明存在访问问题,并且知道托管公司的工作方式,他们可能会阻止该端口(以及所有其他非标准端口)。
You can test this using PuTTY, open it up and enter the host name of your server. Change the port to 80 and change close on window exit to never, then connect. Enter:
您可以使用 PuTTY 进行测试,打开它并输入您的服务器的主机名。将端口更改为 80 并将窗口退出时关闭更改为从不,然后连接。进入:
GET / HTTP/1.1
Host: yourwebsite.com
Then press enter twice and the server will process the result. It should show you the HTML of your home page.
然后按两次回车,服务器将处理结果。它应该显示您主页的 HTML。
Now try it again with port 8888 and see if you can even connect. If you can connect then it's not a port issue, but my guess is you'll get a fatal error Network error: Connection refused
, which means the port is closed or blocked via firewall.
现在使用端口 8888 再试一次,看看是否可以连接。如果您可以连接,那么这不是端口问题,但我猜您会收到一个致命错误Network error: Connection refused
,这意味着该端口已关闭或被防火墙阻止。
Even though DigitalOcean give you complete control over the server, the connection probably still runs through their firewall. It's possible that you have your own firewall, but otherwise if the server runs through their firewall and the port is blocked nothing you can do on the server will open that port.
即使 DigitalOcean 可以让您完全控制服务器,连接可能仍会穿过他们的防火墙。您可能有自己的防火墙,但否则,如果服务器穿过他们的防火墙并且端口被阻止,则您在服务器上无法做的任何事情都会打开该端口。
回答by user3513988
did you try chmod -R 0777 storage
?
你试过chmod -R 0777 storage
吗?