Quantcast
Channel: how to create virtual host on XAMPP - Stack Overflow
Viewing all articles
Browse latest Browse all 17

Answer by develway for how to create virtual host on XAMPP

$
0
0

In Your disk drive:\xampp\apache\conf\extra\httpd-vhosts.conf exists an example and you could edit it with your configuration:

 ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost>

It would be like this, as example and don't forget to add VirtualHost for localhost itself to have posibility run phpmyadmin and other project at the same time on the port 80, as example I will show with store.local project:

<VirtualHost *:80>DocumentRoot "C:/xampp/htdocs"ServerName localhost</VirtualHost><VirtualHost *:80>ServerAdmin webmaster@store.localDocumentRoot "c:/xampp/htdocs/store.local/public"ServerName www.store.localServerAlias store.local<Directory C:/xampp/htdocs/store.local>    AllowOverride All    Require all granted</Directory></VirtualHost>

then as mentioned above you must add in:C:\windows\system32\drivers\hosts to the bottom of the file

127.0.0.1    store.local127.0.0.1    www.store.local

restart Apache and try in the browser:

store.local or www.store.local

maybe at the first time you must to add like this:

http://store.local or http://www.store.local

to use other ports, you must add follows, before your VirtualHost:

Listen 8081 or another which you prefer

then just use the port for your VirtualHost like this:

<VirtualHost *:8081>ServerAdmin webmaster@store.localDocumentRoot "c:/xampp/htdocs/store.local/public"ServerName store.localServerAlias www.store.local<Directory C:/xampp/htdocs/store.local>    AllowOverride All    Require all granted</Directory></VirtualHost>

then restart Apache and try in the browser

store.local:8081 or www.store.local:8081

and only project for which you add the port will running on this port, for example other projects and phpmyadmin will be still running on port 80


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>