如何正确使用Wamp Server设置虚拟主机? [英] How to setup virtual host using Wamp Server properly?

查看:329
本文介绍了如何正确使用Wamp Server设置虚拟主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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.

  1. 我将wordpress文件复制到此文件夹中.这将是我的项目的路径

  1. 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的域名是什么. 例如-> zend_tutorial 然后打开位于"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->zend_tutorial then go and open the file located at "C:\WINDOWS\system32\drivers\etc\"

主机

127.0.0.1(使用一个制表符空间) zend_tutorial

然后转到位于

D:\ wamp \ bin \ apache \ Apache2.2.17(无论您使用什么版本)\ conf \

D:\wamp\bin\apache\Apache2.2.17 (whatever is your version) \conf\

并打开文件

httpd.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 zend_tutorial
   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,现在在浏览器中编写 zend_tutorial ,您会看到一切正常.

and restart the wamp, now write the zend_tutorial in the browser and you will see the things working.

这篇关于如何正确使用Wamp Server设置虚拟主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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