如何更改Laravel的localhost URL [英] How to change localhost url for Laravel

查看:56
本文介绍了如何更改Laravel的localhost URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许是一个非常基本的问题,但我想知道如何将larvel的本地主机URL从 localhost:8000 更改为 something.com .我进行了搜索,但发现xampp和wamp的解决方案不适用于我认为的laravel.

Maybe a pretty basic question but I want to know that how I can change my localhost URL for larvel from localhost:8000 to something.com. I searched but I found solutions for xampp and wamp which does not apply to laravel I think.

推荐答案

设置非常简单.

您需要确保在homestead.yaml文件中映射要使用的域,例如:

You need to ensure that you're mapping the domain you want to use in your homestead.yaml file so it would like this for example:

sites:
    - map: something.com
      to: /home/vagrant/Code/Laravel/public

映射中的to:指向您在Homestead上的Laravel安装中公用文件夹的位置.

The to: in the mapping points to the location of the public folder in your Laravel installation on Homestead.

然后,您需要在计算机上编辑主机文件.

Then you need to edit the hosts file on your computer.

它位于Mac或Linux上的/etc/hosts中,或者您也可以在Windows上的C:\ Windows \ System32 \ drivers \ etc \ hosts中找到它.

It's located at /etc/hosts on Mac or Linux alternatively you can find it at C:\Windows\System32\drivers\etc\hosts on Windows.

您将需要管理员权限才能更改此内容.

You will need administrator rights to change this.

现在更改此:

192.168.10.10  something.com

您可以将something.com更改为要使用的域.

You can change the something.com to the domains you want to use.

更多信息,请参见Homestead文档

这篇关于如何更改Laravel的localhost URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆