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 //查看项目路径设置是否成功
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
关于爬虫和反爬虫的简略方案分享
Python实现aes加密解密多种方法解析
如何使用VSCode愉快的写Python于调试配置步骤
![](https://img.aspxhome.com/file/2023/4/104894_0s.png)
MySQL中的 Binlog 深度解析及使用详情
![](https://img.aspxhome.com/file/2023/8/84538_0s.webp)
python使用电子邮件模块smtplib的方法
![](https://img.aspxhome.com/file/2023/3/63203_0s.jpg)
Mybatis-Plus读写Mysql的Json字段的操作代码
![](https://img.aspxhome.com/file/2023/1/71241_0s.png)
JS实现字符串转驼峰格式的方法
vue日期时间工具类详解
![](https://img.aspxhome.com/file/2023/1/121961_0s.jpg)
通用的下拉菜单__用DL\\DD\\DT解决无法遮住select的问题
全屏flash的尺寸分析
![](https://img.aspxhome.com/file/UploadPic/20092/11/01-11s.jpg)
javascript实现小型区块链功能
![](https://img.aspxhome.com/file/2023/9/136609_0s.png)
几款好用的前端开发编辑器推荐安利
![](https://img.aspxhome.com/file/2023/6/71296_0s.png)
Python time模块时间获取和转换方法
PyTorch手写数字数据集进行多分类
对python3 sort sorted 函数的应用详解
Golang将Map的键值对调的实现示例
![](https://img.aspxhome.com/file/2023/0/134050_0s.png)
Python黑魔法之metaclass详情
Python+OpenCV实现在图像上绘制矩形
![](https://img.aspxhome.com/file/2023/4/66894_0s.jpg)