欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Apache为mysql以及自己的项目设置虚拟路径

程序员文章站 2022-09-08 17:38:13
1.apache2.2\conf\httpd.conf中释放: include conf/extra/httpd-vhosts.conf(去掉前面的#) 2.httpd.c...
1.apache2.2\conf\httpd.conf中释放:
include conf/extra/httpd-vhosts.conf(去掉前面的#)
2.httpd.conf中增加
<directory "e:/work/test"> #项目文件夹dwm目录,注意不要使用中文定义目录与文件夹
#
# possible values for the options directive are "none", "all",
# or any combination of:
# indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# note that "multiviews" must be named *explicitly* --- "options all"
# doesn't give it to you.
#
# the options directive is both complicated and important. please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
options followsymlinks
#
# allowoverride controls what directives may be placed in .htaccess files.
# it can be "all", "none", or any combination of the keywords:
# options fileinfo authconfig limit
#
allowoverride none
#
# controls who can get stuff from this server.
#
order allow,deny
allow from all
</directory>
<directory "c:/phpmyadmin"> #phpmyadmin的安装路径
#
#
# possible values for the options directive are "none", "all",
# or any combination of:
# indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# note that "multiviews" must be named *explicitly* --- "options all"
# doesn't give it to you.
#
# the options directive is both complicated and important. please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
options indexes followsymlinks
#
# allowoverride controls what directives may be placed in .htaccess files.
# it can be "all", "none", or any combination of the keywords:
# options fileinfo authconfig limit
#
allowoverride none
#
# controls who can get stuff from this server.
#
order allow,deny
allow from all
</directory>
3.在文件apache2.2\conf\extra\httpd-vhosts.conf中增加:
复制代码 代码如下:

<virtualhost *:80> #放在第一个
serveradmin webmaster@dummy-host2.ies.inventec
documentroot "d:\work\test"
servername test
errorlog "logs/dummy-host2.ies.inventec-error.log"
customlog "logs/dummy-host2.ies.inventec-access.log" common
</virtualhost>
<virtualhost *:80>
serveradmin webmaster@dummy-host2.ies.inventec
documentroot "c:\program files\phpmyadmin-2.11.4"
servername mysql
errorlog "logs/dummy-host2.ies.inventec-error.log"
customlog "logs/dummy-host2.ies.inventec-access.log" common
</virtualhost>
<virtualhost *:80>
serveradmin webmaster@dummy-host2.ies.inventec
documentroot "c:\program files\apache software foundation\apache2.2\htdocs"
servername localhost
errorlog "logs/dummy-host2.ies.inventec-error.log"
customlog "logs/dummy-host2.ies.inventec-access.log" common
</virtualhost>

4.在windows\system32\drivers\etc\hosts檔中增加:(是hosts檔,不是hosts.msn之类的)
127.0.0.1 test
127.0.0.1 mysql
5.在浏览器中输入:
http://mysql/index.php //查看数据库设置是否成功
http://test/index.php //查看项目路径设置是否成功