首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Laravel LocalHost服务器到APP_URL .test的转换

从Laravel LocalHost服务器到APP_URL .test的转换
EN

Stack Overflow用户
提问于 2022-07-31 02:53:57
回答 4查看 360关注 0票数 1

所以我使用命令PHP artisan serve来运行服务器,我可以在http://127.0.0.1:8000/上查看我的Laravel站点,但是我想在APP_URL= 'http://projectName.test‘上运行我的网站,我该怎么做呢?我在网上看到了很多视频,这些视频都是自动旋转的。

MySQL Win11 XAMP

EN

回答 4

Stack Overflow用户

发布于 2022-07-31 05:27:40

可以设置虚拟主机,以便在本地主机中的自定义URL上运行项目。

此链接是定义虚拟主机的一个示例。

票数 0
EN

Stack Overflow用户

发布于 2022-07-31 05:45:08

用这个:

php artisan serve --host=projectName.test --port=80

这也是serve手册:

代码语言:javascript
复制
Description:
  Serve the application on the PHP development server

Usage:
  serve [options]

Options:
      --host[=HOST]     The host address to serve the application on [default: "127.0.0.1"]
      --port[=PORT]     The port to serve the application on
      --tries[=TRIES]   The max number of ports to attempt to serve from [default: 10]
      --no-reload       Do not reload the development server on .env file changes
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
票数 0
EN

Stack Overflow用户

发布于 2022-07-31 07:47:23

更改主机文件参数,如:

代码语言:javascript
复制
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1           projectName.test

将目录更改为根项目并运行:

代码语言:javascript
复制
php artisan serve --host=projectName.test --port=80
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73180361

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档