在Xamp Windows 10中创建虚拟主机 [英] Create a Virtual Host in Xamp Windows 10

查看:119
本文介绍了在Xamp Windows 10中创建虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨晚我已将Windows 7更新为Windows 10.

Last night I have updated my windows 7 to windows 10.

结果是尝试在Windows 7上运行的Windows 10中运行我的本地apache服务器很费劲.我试图卸载并安装另一个版本的xampp,然后我不得不更改apache的默认端口以使它运行.

The result is struggle trying to run my local apache server in windows 10 that is running on windows 7.I have tried uninstalling and installing another versions of xampp then I came up that I have to change the apache's default port just to make it run.

我更改了httpd.conf

I changed httpd.conf

Listen 80 Listen 1234

from Listen 80 to Listen 1234

ServerName localhost:80 ServerName localhost:1234

AND ServerName localhost:80 to ServerName localhost:1234

,然后在 xampp控制面板上的配置"->服务和端口设置"​​ 中.我还更改了主端口

and in xampp control panel Config->Service and Port Settings. I also change the Main Port

现在,我可以使用 localhost:1234/phpmyadmin 访问phpmyadmin. 现在我的问题是创建虚拟主机

Now I can access phpmyadmin using localhost:1234/phpmyadmin. And now my problem is creating Virtual host

所以我添加了我的主机(C:\ Windows \ System32 \ drivers \ etc \ hosts)文件

so I added in my host(C:\Windows\System32\drivers\etc\hosts) file

127.0.0.1       sample.local
127.0.0.1       anothersample.local

还有我的虚拟主机(D:\ xampp \ apache \ conf \ extra \ httpd-vhosts.conf)文件

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

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

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

我确实确保上面的虚拟主机文件包含

I did make sure the vhost file above was include

我已经重新启动了Apache,但是好像我的虚拟主机无法正常工作.有人可以指出我错过的内容吗?

I already restarted my apache but seems like my vhost is not working .Can anyone point out what i missed?

推荐答案

谢谢@ShamSUP和@maytham-ɯɐɥıλɐɯ我能够通过卸载xampp解决问题.

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

然后按照说明此处

我将在这里列出我已完成的步骤.

I will just list the steps I have done here.

  1. Windows + R并键入appwiz.cpl并使用打开或关闭Windows功能"并通过展开来安装IIS管理器控制台 Internet Information Services-> Web Management Tools->然后检查IIS Management Console
  2. Windows + R并键入InetMgr.exe并输入,然后展开Site右键单击它,然后单击Edit Bindings
  3. http 端口从 80 更改为 8080
  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

之后,我将安装XAMPP并配置虚拟主机

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

主机(C:\ Windows \ System32 \ drivers \ etc \ hosts)文件

127.0.0.1       sample.local
127.0.0.1       anothersample.local

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

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

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

并且默认情况下,Windows虚拟主机中未注释

And by default in windows virtual host is uncommented

重启apache和mysql之后,虚拟主机正在运行,希望对以后的人有所帮助.

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

这篇关于在Xamp Windows 10中创建虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆