about uscontact

How to set php artisan serve with custom domain in Laravel on Windows

Category:
Author: zemna
Date: April 25, 2021
Share this:

php artisan serve command runs your website with 127.0.0.1 ip and 8000 port by default.

How can we serve with custom domain like zemna.test for development?

Before starrt

You can use any name of domain only for your computer. But the best practice is use .local or .test domain.

In past, .dev domain also be used many times.

But .dev domain will be automatically redirect to https protocol by browser.

So, use .local or .test domain.

Add custom domain mapping in Windows hosts file

Open C:\Windows\System32\drivers\etc file, and add a new line

127.0.0.1 zemna.test

Upate app url in .env file

Update APP_URL in your .env file

APP_URL=http://zemna.test

Run php artisan serve command with custom domain

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

Access your web application using custom domain

You can access your web application with custom domain.

Share this:

Leave a Reply

Your email address will not be published.

ZEMNA.NET

Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
magnifiercrossmenu