So I use the command PHP artisan serve
to run a server and I can view my Laravel site at http://127.0.0.1:8000/ but I want to run my website at the
APP_URL= 'http://projectName.test' how can I do this? I see a lot of videos online where it just spins up that way automatically.
MySQL Win11 XAMP
CodePudding user response:
You can set up a virtual host to run the project on the custom URL in localhost.
this link is an example of defining a virtual host.
CodePudding user response:
Use this:
php artisan serve --host=projectName.test --port=80
Also this is serve
manual:
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
CodePudding user response:
change host file parameter like:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 projectName.test
change directory to root project and run:
php artisan serve --host=projectName.test --port=80
CodePudding user response:
Take a peek at Laragon. I think Laragon is a better choice than XAMPP. And in your case, using Laragon don't require you to run php artisan serve
to run the app. Just turn on the Laragon, and your app will be able to be accessed from http://your-app.test
(suffix can be changed). No additional configuration or changes needed.