在 Xamp Windows 10 中创建虚拟主机 [英] Create a Virtual Host in Xamp Windows 10
问题描述
昨晚我将 Windows 7 更新到了 Windows 10.
结果是试图在 windows 7 上运行的 windows 10 中运行我的本地 apache 服务器.我尝试卸载和安装另一个版本的 xampp 然后我想我必须更改 apache 的默认端口只是为了它运行.
我改变了 httpd.conf
从Listen 80
到Listen 1234
与ServerName localhost:80
到 ServerName localhost:1234
在 xampp 控制面板配置->服务和端口设置.我还更改了主端口
现在我可以使用 localhost:1234/phpmyadmin
访问 phpmyadmin.现在我的问题是创建虚拟主机
所以我在我的主机(C:WindowsSystem32driversetchosts)文件中添加了
127.0.0.1 sample.local127.0.0.1 另一个sample.local
还有我的虚拟主机(D:xamppapacheconfextrahttpd-vhosts.conf)文件
<VirtualHost *:1234>DocumentRoot "D:/xampp/htdocs/sample"服务器名称 sample.local</虚拟主机><虚拟主机 *:1234>DocumentRoot "D:/xampp/htdocs/anothersample"服务器名称 anothersample.local</虚拟主机>
我确实确保上面的 vhost 文件是包含的
我已经重新启动了我的 apache,但我的虚拟主机似乎无法正常工作.谁能指出我错过了什么?
谢谢@ShamSUP AND @maytham-ɯɐɥıλɐɯ 我能够通过卸载 xampp 解决我的问题.
然后按照
重新启动apache和mysql后.虚拟主机现在正在运行.我希望这对将来的人有所帮助.
Last night I have updated my windows 7 to windows 10.
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.
I changed httpd.conf
from Listen 80
to Listen 1234
AND
ServerName localhost:80
to ServerName localhost:1234
and in xampp control panel Config->Service and Port Settings. I also change the Main Port
Now I can access phpmyadmin using localhost:1234/phpmyadmin
.
And now my problem is creating Virtual host
so I added in my host(C:WindowsSystem32driversetchosts) file
127.0.0.1 sample.local
127.0.0.1 anothersample.local
And my vhost (D:xamppapacheconfextrahttpd-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
I already restarted my apache but seems like my vhost is not working .Can anyone point out what i missed?
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.
- Windows+R and type
appwiz.cpl
and use Turn Windows features on or off and install the IIS Manager Console by expandingInternet Information Services
->Web Management Tools
->then checkingIIS Management Console
- Windows+R and type
InetMgr.exe
and enter, then expandSite
Right Click it then clickEdit Bindings
- Change the http port from 80 to 8080
After that I then install the XAMPP and configure the Virtual host
host(C:WindowsSystem32driversetchosts) file
127.0.0.1 sample.local
127.0.0.1 anothersample.local
vhost (D:xamppapacheconfextrahttpd-vhosts.conf) file
<VirtualHost *:80>
DocumentRoot "D:xampphtdocssample"
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.
这篇关于在 Xamp Windows 10 中创建虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!