如何正确使用 Wamp Server 设置虚拟主机? [英] How to setup virtual host using Wamp Server properly?
问题描述
我需要你的帮助来在 wampserver 中创建一个虚拟主机.在办公室我可以创建一个虚拟主机,但是当我尝试在我的笔记本电脑中创建它时它不起作用.我仍然无法弄清楚出了什么问题.这就是我所做的.
I need your help here in creating a virtual host in wampserver. In office I can create a virtual hosts but when I try to create in my laptop it doesn't work. I still can't figure out what's wrong. Here's what I did.
我将 wordpress 文件复制到此文件夹中.这将是我项目的路径
I copy the wordpress file in this folder. This will be the path of my project
- E:\Subversion\chelle.wpblog.local
我编辑主机文件
- C:\Windows\System32\drivers\etc\hosts
我把它加到文件末尾
- C:\Windows\System32\drivers\etc\hosts
I added it to the end of file
127.0.0.1 chelle.wpblog.local
127.0.0.1 chelle.wpblog.local
接下来是我在 Apache 中启用虚拟主机
Next is I enable the virtual host in Apache
- C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
我取消注释
- C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
I uncomment this
包括 conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-vhosts.conf
接下来是在 WAMP 中设置虚拟主机
Next is I setup the virtual host in WAMP
- C:\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf
我在底部添加这个
- C:\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf
I add this at the bottom
<VirtualHost *:80>
ServerName chelle.wpblog.local
ServerAlias chelle.wpblog.local
DocumentRoot "E:/Subversion/chelle.wpblog.local/"
<Directory "E:/Subversion/chelle.wpblog.local/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
最后是重启wampserver并在浏览器中打开chelle.wpblog.local.而且不显示.它只显示谷歌搜索结果.
Last is restart wampserver and open the chelle.wpblog.local in the browser. And it doesn't display. It display only google search results.
推荐答案
我正在使用 apache 服务器在本地 wamp 上安装 zend 框架.首先决定本地 url 的域名是什么.前->www.test_zend_tutorial.com然后打开位于"C:\WINDOWS\system32\drivers\etc"
I was installing the zend framework on my local wamp using apache server. First go and decide what will be your domain name for the local url. Ex->www.test_zend_tutorial.com then go and open the file located at "C:\WINDOWS\system32\drivers\etc"
主机
写
127.0.0.1(使用一个制表符空间)www.test_zend_tutorial.com
127.0.0.1 (use one tab space) www.test_zend_tutorial.com
然后转到位于
D:\wamp\bin\apache\Apache2.2.17(不管你的版本是什么)\conf\
D:\wamp\bin\apache\Apache2.2.17 (whatever is your version) \conf\
打开文件
httpd.conf
并搜索文本
包括 conf/extra/httpd-vhosts.conf
和通过从行的开头删除 # 标记来取消注释.保存文件并关闭它.现在转到位于
and uncomment it by removing the # tag from the start of the line.Save the file and close it. Now go to another folder located at
D:\wamp\bin\apache\Apache2.2.17\conf\extra
D:\wamp\bin\apache\Apache2.2.17\conf\extra
打开文件
httpd-vhosts.conf
httpd-vhosts.conf
并将下面的代码粘贴到此文件的最后
and paste the code below at the last in this file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "D:\wamp\www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName www.test_zend_tutorial.com
DocumentRoot "D:\wamp\www\(your project folder name)\public"
SetEnv APPLICATION_ENV "development"
<directory "D:\wamp\www\(your project folder name)\public">
DirectoryIndex index.php
AllowOverride all
Order Allow,Deny
Allow from all
</directory>
</VirtualHost>
并重新启动 wamp,现在在浏览器中写入 www.test_zend_tutorial.com,您将看到一切正常.
and restart the wamp, now write the www.test_zend_tutorial.com in the browser and you will see the things working.
这篇关于如何正确使用 Wamp Server 设置虚拟主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!