Hi I am on windows and I am using xampp and Laravel
I have multiple laravel apps and I want to run them at the same time and make them accessible to other PC on my local network.
Is it possible ? if yes, how ?
I want also, if possible, to run these apps without php artisan serve command.
I did it for one app using the httpd-vhosts.conf of xampp but didn't know how to do it for multiple apps. So what I did is I created a virtual host to make one app accessible directly from another PC through browser using IP address, so is there a way to create multiple virtual hosts like this at the same time ? or there is a better way ?
Thanks.
CodePudding user response:
Go to xampp\apache\conf\extra and open httpd-vhosts.conf file.
<VirtualHost *:80>
DocumentRoot "/Users/laravel2/public"
ServerName laravel2.dev
<Directory "/Users/laravel2/public">
AllowOverride All
Options FollowSymLinks Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/laravel1/public"
ServerName laravel1.dev
<Directory "/Users/laravel1/public">
AllowOverride All
Options FollowSymLinks Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Go => C:\Windows\System32\drivers\etc
127.0.0.1 localhost laravel1.dev
127.0.0.1 localhost laravel2.dev
Restart your apache. It's working for me.
CodePudding user response:
In this case, I recommend you to use Laragon instead of xampp.
Some of Laragon Features:
- Easy to use.
- Use app.test instead of localhost/app and no need extra configuration for this.
- No need to run php artisan serve command to run laravel project
- You can share your local project with anyone over the internet in just matter of some clicks
- You can move Laragon folder around (to another disks, to another laptops, sync to Cloud,…) without any worries.
Anyway, I'm using Laragon all the time.