如何在本地主机的端口 80 上运行 laravel 5?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29592441/
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
How to run laravel 5 on port 80 of localhost?
提问by cytsunny
For previous versions of Laravel, you can simply download laravel with composer in the root folder of your apache server and type in http://localhost/public/
to see the "You've arrived" homepage.
对于以前的 Laravel 版本,你可以简单地在你的 apache 服务器的根文件夹中下载带有 composer 的 laravel 并输入http://localhost/public/
查看“你到了”主页。
I know I can use php artisan serve
to view the Laravel5 default home page, but it is run on localhost:8000
and I heard that php artisan serve
command should not be used in production due to the limit of connection and the bad performance. Is there a way I can see the default home page without using the php artisan serve
command?
我知道我可以用它php artisan serve
来查看 Laravel5 默认主页,但它正在运行localhost:8000
,我听说php artisan serve
由于连接限制和性能不佳,该命令不应在生产中使用。有没有办法可以在不使用php artisan serve
命令的情况下查看默认主页?
And it is really frustrating that Laravel is not including such simple thing in their installation documentation....
令人沮丧的是,Laravel 没有在他们的安装文档中包含这么简单的东西......
回答by mininoz
To run the service on another port you need to pass the port parameter
with port number
using this code on the cmd:
要在另一个端口上运行该服务,您需要在 cmd 上使用以下代码传递port parameter
with port number
:
php artisan serve --port=80
To run on port 80
, you might need administrator permission.
要在 port 上运行80
,您可能需要管理员权限。
回答by Krishnamoorthy Acharya
You may have to use sudo command for admin rights.
您可能必须使用 sudo 命令来获得管理员权限。
sudo php artisan serve --port=80