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

admin3年前服务器114

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导致xampp的mysql服务启动失败

由于本地安装了mysql导致xampp里面的mysql启动失败问题原因,在启动的xampp的mysql时启动了本地的mysql解决方法 :修改mysql的注册表1.打开cmd 输入regedit自动弹...

phpstudy mysql启动不了的解决方法

很让人头疼的是Apache正常启动,MySql就是无法启动,百度上说的也不咋有用(不一竿子打死,最终解决办法的前身还是百度的),百度上大多数是说的端口问题,Apache是80,MySql是3306,然...

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

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

阿里云ECS云服务器(linux系统)安装mysql后远程连接不了(踩坑)

昨天买了一年的阿里云服务器,系统是linux Centos7的,满怀憧憬的装了个mysql,接下来的一天让我差点怀疑人生。。。怎么装mysql就不多说了,反正我装了三遍,每次在阿里云上都能本地连接数据...

阿里云云服务器mysql密码找回的方法

首先,如果你是刚刚安装mysql,密码就是他给的随机密码,可以通过路径为/var/log/mysqld.log cd 到指定目录cd /var/log然后vi mysqld.log查看日志文件中的[N...

MySQL和SQLite有什么区别?MySQL和SQLite比较

mysql和sqlite有什么区别?MySQL和SQLite是当前两款主流的开源关系数据库管理系统(RDBMS)。我们在创建网站时,一般需要选择合适的数据库来存储数据,现在可以使用的开源数据库种类繁多...