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

admin3年前服务器72

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
# httpd.apache.org/docs/2.2/mod/core#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
# httpd.apache.org/docs/2.2/mod/core#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.在浏览器中输入:
mysql/index.php //查看数据库设置是否成功
test/index.php //查看项目路径设置是否成功

免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

Web服务器Tomcat的这些架构模块,您都知道吧?

俗话说,站在巨人的肩膀上看世界,一般学习的时候也是先总览一下整体,然后逐个部分个个击破,最后形成思路,了解具体细节,Tomcat的结构很复杂,但是 Tomcat 非常的模块化,找到了 Tomcat最核...

为何要购买域名和空间,如何购买域名和空间

1.什么是域名和空间?域名是指互联网上的网站名称,它是网站的最标识。而空间则是指存储网站文件和提供访问服务的服务器存储空间。2.购买域名和空间的目的是什么?购买域名和空间是为了建立自己的网站,实现个人...

虚拟主机试用30天到底值不值得投资,虚拟主机试用30天

1.什么是虚拟主机?虚拟主机是一种将多个网站放置在同一台服务器上的服务。与独立服务器不同,虚拟主机不需要自己维护服务器硬件运行,而是由服务提供商负责。虚拟主机通常拥有较低的成本和管理门槛,在网站初期和...

塔式服务器,附详细介绍

什么是塔式服务器?塔式服务器的特点与优劣1.塔式服务器塔式服务器,是指外形类似于塔的服务器,通常采用独立式架构,适合企业、机构等环境使用。塔式服务器一般采用了高效的散热技术,可以保证服务器在长时间运行...

香港空间,附详细介绍

香港空间是如何塑造的?香港空间的多元文化1.什么是香港空间?香港空间是指香港的城市空间,它是一个复杂的概念,包括了城市规划、建筑设计、社交空间和公共空间等方面。香港空间的塑最映了香港社会、文化、经济历...

虚拟主机香港主机,附详细介绍

为什么选择虚拟主机香港主机?虚拟主机香港主机的优势和特点1.什么是虚拟主机香港主机?虚拟主机,简称VPS(VirtualPrivateServer),也叫虚拟专用服务器,是通过软件将一台物理服务器虚拟...