Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

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

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *