设置本地虚拟域名windows+apache
C:\WINDOWS\system32\drivers\etc\hosts
在这个文件中 最下面添加。
- 127.0.0.1 localhost.com
- 127.0.0.1 cho.com
- 127.0.0.1 devwo.com
- 127.0.0.1 phpmyadmin.com
信息来自:http://blog.sina.com.cn/s/blog_7347580d0100w88d.html
D:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf
添加与hosts 相应的 映射
- #
- # Virtual Hosts
- #
- # If you want to maintain multiple domains/hostnames on your
- # machine you can setup VirtualHost containers for them. Mostconfigurations
- # use only name-based virtual hosts so the server doesn't need toworry about
- # IP addresses. This is indicated by the asterisks in thedirectives below.
- #
- # Please see the documentation at
- #<URL:http://httpd.apache.org/docs/2.2/vhosts/>
- # for further details before you try to setup virtual hosts.
- #
- # You may use the command line option '-S' to verify your virtualhost
- # configuration.
- #
- # Use name-based virtual hosting.
- #
- NameVirtualHost *:80
- #
- # VirtualHost example:
- # Almost any Apache directive may go into a VirtualHostcontainer.
- # The first VirtualHost section is used for all requests that donot
- # match a ServerName or ServerAlias in any<VirtualHost> block.
- #
- <VirtualHost *:80>
- ServerAdminwebmaster@dummy-host.hleclerc-PC.ingenidev
- DocumentRoot"C:/Dev/Projets/WampServer2-64b/install_files_wampserver2/bin/apache/Apache2.2.17/docs/dummy-host.hleclerc-PC.ingenidev"
- ServerNamedummy-host.hleclerc-PC.ingenidev
- ServerAliaswww.dummy-host.hleclerc-PC.ingenidev
- ErrorLog"logs/dummy-host.hleclerc-PC.ingenidev-error.log"
- CustomLog"logs/dummy-host.hleclerc-PC.ingenidev-access.log" common
- </VirtualHost>
- <VirtualHost *:80>
- ServerAdminwebmaster@dummy-host2.hleclerc-PC.ingenidev
- DocumentRoot"C:/Dev/Projets/WampServer2-64b/install_files_wampserver2/bin/apache/Apache2.2.17/docs/dummy-host2.hleclerc-PC.ingenidev"
- ServerNamedummy-host2.hleclerc-PC.ingenidev
- ErrorLog"logs/dummy-host2.hleclerc-PC.ingenidev-error.log"
- CustomLog"logs/dummy-host2.hleclerc-PC.ingenidev-access.log" common
- </VirtualHost>
- /*-----------------------------*/
- <VirtualHost *:80>
- Options None
- ServerAdmin cho.com
- DocumentRoot E:\PHP\PHPProject\inpiao
- ServerName cho.com
- ErrorLog logs/phpmyadmin.com-error_log
- CustomLog logs/phpmyadmin.com-access_log common
- php_admin_value open_basedir "E:\PHP\PHPProject\inpiao"
- </VirtualHost>
- <VirtualHost *:80>
- Options None
- ServerAdmin devwo.com
- DocumentRoot E:\PHP\PHPProject\devwo
- ServerName devwo.com
- ErrorLog logs/phpmyadmin.com-error_log
- CustomLog logs/phpmyadmin.com-access_log common
- php_admin_value open_basedir "E:\PHP\PHPProject\devwo"
- </VirtualHost>
- <VirtualHost *:80>
- Options None
- ServerAdmin localhost.com
- DocumentRoot E:\PHP\PHPProject
- ServerName localhost.com
- ErrorLog logs/phpmyadmin.com-error_log
- CustomLog logs/phpmyadmin.com-access_log common
- php_admin_value open_basedir "E:\PHP\PHPProject"
- </VirtualHost>
- <VirtualHost *:80>
- Options None
- ServerAdmin phpmyadmin.com
- DocumentRoot D:\wamp\apps\phpmyadmin3.3.9
- ServerName phpmyadmin.com
- ErrorLog logs/phpmyadmin.com-error_log
- CustomLog logs/phpmyadmin.com-access_log common
- php_admin_value open_basedir "D:\wamp\apps\phpmyadmin3.3.9"
- </VirtualHost>
最后在 \conf\httpd.conf 中 开启
# Virtual hosts
Include conf/extra/httpd-vhosts.conf