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

admin3年前服务器51

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 //查看项目路径设置是否成功

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

相关文章

腾讯云:数据库最新优惠活动,mysql数据库低至1.1折首年仅需186元

腾讯云数据库最新优惠活动开始了!腾讯云首单秒杀活动不仅仅对云服务器进行优惠,其实还有很多云数据库一样享受很大的优惠,腾讯云数据库的价格跟数据库类型、规格、配置和优惠活动有关。目前腾讯云数据库最新优惠活...

mysql服务器版本和客户端版本的区别是什么

MySQL 服务器版本和客户端版本的区别主要在于功能和应用范围上的差异:1、功能差异MySQL 服务器版本提供了完整的数据库管理功能,包括创建、修改、查询和删除数据库、数据表等,以及支持事务、索引、备...

phpnow重新安装mysql数据库的方法

1.phpnow下重装Mysql数据库如果之前重装过系统或卸载过服务,原先的Mysql文件夹完全保留原状,只需要将mysql安装成服务,可以按以下步骤操作:在bin目录下msyql\bin>my...

redis和mysql哪个好?MySQL和Redis的区别

redis和mysql哪个好?redis在很多方面同时具备mysql及Memcached使用特征,在某些方面则更像MySQL。由于Redis数据不能超过内存大小,一方面需要进行事先容量规划,保证容量足...

mongodb是什么数据库?mongodb和mysql的区别

MongoDB是什么数据库?什么是MongoDB?开源的NoSQL数据库,用于存储非结构化数据,SQL中的绝大多数操作有对应的方式来实现,采用BSON描述数据类型!MongoDB是一款为web应用程序...

宝塔面板定时检测mysql状态并自动启动脚本分享

宝塔面板使用过程中经常遇到内存占用高,清理内存的场景,有时候由于内存低或者其他情况引起的数据库停止,可以通过添加一个计划任务定时检测mysql状态,如果检测mysql处于停止状态就会自动启动。添加自动...