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

时间:2024-01-27 23:45:05 

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

标签:Apache,虚拟路径
0
投稿

猜你喜欢

  • 关于爬虫和反爬虫的简略方案分享

    2022-08-01 09:54:53
  • Python实现aes加密解密多种方法解析

    2021-05-13 01:36:53
  • 如何使用VSCode愉快的写Python于调试配置步骤

    2021-11-21 06:16:12
  • MySQL中的 Binlog 深度解析及使用详情

    2024-01-19 04:15:48
  • python使用电子邮件模块smtplib的方法

    2023-09-29 20:20:38
  • Mybatis-Plus读写Mysql的Json字段的操作代码

    2024-01-15 15:34:29
  • JS实现字符串转驼峰格式的方法

    2024-04-10 13:58:45
  • vue日期时间工具类详解

    2024-06-07 16:06:22
  • 通用的下拉菜单__用DL\\DD\\DT解决无法遮住select的问题

    2008-07-28 13:28:00
  • 全屏flash的尺寸分析

    2009-02-11 13:22:00
  • javascript实现小型区块链功能

    2024-04-18 09:29:10
  • 几款好用的前端开发编辑器推荐安利

    2023-11-21 13:30:00
  • Python time模块时间获取和转换方法

    2022-06-07 11:14:30
  • PyTorch手写数字数据集进行多分类

    2022-10-18 22:29:23
  • 对python3 sort sorted 函数的应用详解

    2022-08-01 23:44:45
  • Golang将Map的键值对调的实现示例

    2024-04-27 15:32:40
  • Python黑魔法之metaclass详情

    2022-09-16 00:38:56
  • Python+OpenCV实现在图像上绘制矩形

    2023-07-27 15:29:58
  • asp自动生成javascript检验函数

    2009-01-21 19:40:00
  • 使用Python的SymPy库解决数学运算问题的方法

    2021-04-19 19:36:35
  • asp之家 网络编程 m.aspxhome.com