Create a Virtual Host in Xamp Windows 10

梦想与她 提交于 2019-12-04 16:02:47
jameshwart lopez

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 uncommented

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

atyagi

Maybe my issue is different. Above answer not worked for me Windows 10, XAMPP portable 5.6.30

My XAMPP works on port 80 but when I set virtual host then its localhost also go to virtual host folder. So http://localhost also shows the content of http://mydrupal

I simply added this to /apache/conf/extra/httpd-vhosts.conf file as well.

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs"
    ServerName localhost
    <Directory D:/xampp/htdocs>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Above code was not required on Windows 7.

For virtual host - mydrupal

<VirtualHost *:80>
DocumentRoot "D:/vhosts/drupal"
ServerName mydrupal
<Directory D:/vhosts>
    AllowOverride All
    Require all granted
</Directory>
</VirtualHost>

Hope this helps.

E:\xampp\apache\conf\extra\httpd-vhosts.conf

</VirtualHost>
  <VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs/dev2017/schools"
    ServerName dev.schools
    <Directory "E:/xampp/htdocs/dev2017/schools">

    </Directory>
</VirtualHost>

C:\Windows\System32\drivers\etc\hosts

127.0.0.1       dev.schools

NOTE: Restar Xampp Server.

Type URL: http://dev.schools

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!