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

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

相关文章

phpstudy v8.1 Apache伪静态配置

apache伪静态配置,需要网站根目录下有 .htaccess 文件,没有则需要自己创建一个,phpStudy V8能够自动生成这样一个文件,免去了繁琐的配置过程。以下为Apache伪静态的配置具体教...

一篇文章搞懂Nginx是什么,能干什么

Nginx的产生没有听过Nginx?那么一定听过它的"同行"Apache吧!Nginx同Apache一样都是一种WEB服务器。基于REST架构风格,以统一资源描述符(Uniform...

Apache跨域资源访问报错问题解决方案

很多时候,大中型网站为了静态资源分布式部署,加快访问速度,减轻主站压力,会把静态资源(例如字体文件、图片等)放在独立服务器或者CDN上,并且使用独立的资源域名(例如res.test)但是在实际部署中,...

Nginx vs Apache两大web服务器比较

互联网从90年代开始席卷全球,现如今基本上所有业务都可以在互联网上完成,互联网已经成为我们生活中不可或缺的一部分。那么互联网web协议是怎样的呢?可以概括为访问者从给定的Web站点请求文档,而DNS和...

linux下要怎样安装php环境(linux怎么安装php环境)

本文将介绍如何在Linux系统中安装PHP环境。在Ubuntu系统中,使用以下命令安装Apache:```sudo apt-get updatesudo apt-get install apache2...

Apache 配置详解(最好的APACHE配置教程)

Apache的配置Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd.conf文件中修改。 主站点的配置(基本配置)(1) 基本配置:ServerRoot...