How to Create Virtual Host on Xampp

how to create virtual host on XAMPP

I see two errors:

<VirtualHost *:80> -> Fix to :8081, your POrt the server runs on
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public" -> This is probably why it crashes, missing >
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
-> MIssing close container: </VirtualHost>

Fixed version:

<VirtualHost *:8081>
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

One thing to mention:

You can always try and run command:

service apache2 configtest

This will tell you when you got a malformed configuration and maybe even can tell you where the problem is.

Furthermore it helps avoid unavailability in a LIVE system:

service apache2 restart

will shutdown and then fail to start, this configtest you know beforehand "oops I did something wrong, I should fix this first" but the apache itself is still running with old configuration. :)

How to create virtual host in Xampp windows 10

You need to correct your settings like below :- need to define {projectName}

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/bab/{projectName}"
ServerName bab.local
<Directory "c:/xampp/htdocs/bab/">

</Directory>
</VirtualHost>

How to setup Virtual Host on XAMPP?

You made a typo error on your host file.

Since you used

local.demoapp.com

as your server name, your host file should be

127.0.0.1    local.demoapp.com

Set up virtual hosts on Apache (XAMPP, Windows 10)

You should change: <VirtualHost *:8081> to <VirtualHost *:80> on both counts, fw.local.com attempts to connect to port 80, not 8081.

Edit: You could also keep it the way you have it and connect to: http://fw.local.com:8081/

Create a Virtual Host in Xamp Windows 10

Thank you @ShamSUP AND @maytham-ɯɐɥıλɐɯ I was able to solve my problem by uninstalling the xampp.

Then following the instructions here

I will just list the steps I have done here.

  1. Windows+R and type appwiz.cpl and use Turn Windows features on or off and install the IIS Manager Console by expanding
    Internet Information Services->Web Management Tools->then checking IIS Management Console
  2. Windows+R and type InetMgr.exe and enter, then expand Site Right Click it then click Edit Bindings
  3. Change the http port from 80 to 8080

After that I then install the XAMPP and configure the Virtual host

host(C:\Windows\System32\drivers\etc\hosts) file

127.0.0.1       sample.local
127.0.0.1 anothersample.local

vhost (D:\xampp\apache\conf\extra\httpd-vhosts.conf) file

<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs\sample"
ServerName sample.local
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/anothersample"
ServerName anothersample.local
</VirtualHost>

And by default in windows virtual host is uncommentedSample Image

After restarting apache and mysql.The Virtual host is running now.I hope this may help someone in the future.



Related Topics



Leave a reply



Submit