服务器之家:专注于服务器技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - WEB服务器 - Apache为mysql以及自己的项目设置虚拟路径

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

2020-11-29 15:30服务器技术网 WEB服务器

Apache为mysql以及自己的项目设置虚拟路径的实现方法,有需要的朋友可以参考下

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

延伸 · 阅读

精彩推荐
  • WEB服务器宝塔面板负载状态(load average)中的数据代表了什么?

    宝塔面板负载状态(load average)中的数据代表了什么?

    宝塔面板是现在众多站长选择的服务器管理软件,本文主要讲解宝塔面板负载状态(load average)中的数据代表了什么?有需要的朋友可以参考一下。...

    九天博客5792020-05-23
  • WEB服务器阿里云服务器部署web项目查看

    阿里云服务器部署web项目查看

    阿里 云服务器 部署web项目查看 随着互联网的发展,越来越多的企业开始将自己的业务扩展到线上平台。为了满足用户的需求,企业需要部署自己的网站或...

    未知872023-09-07
  • WEB服务器WDCP控制面板升级mysql为5.7.11的方法

    WDCP控制面板升级mysql为5.7.11的方法

    本文主要讲解在WDCP控制面板升级mysql为5.7.11的方法,有需要的朋友可以参考下...

    yuanxiaoping5322020-07-15
  • WEB服务器如何将web项目部署到腾讯云服务器

    如何将web项目部署到腾讯云服务器

    如何将Web项目部署到腾讯 云服务器 摘要:本文将详细介绍如何将Web项目部署到 腾讯云服务器 。包括选择合适的云服务器实例,配置服务器环境,上传代码...

    未知1952023-06-24
  • WEB服务器云服务器安装多个web网站吗

    云服务器安装多个web网站吗

    云服务器 安装多个web网站 云服务器是一种基于云计算技术的 虚拟主机 服务,可以提供各种云计算基础设施和服务。作为一个虚拟主机,云服务器可以用于...

    未知1302023-07-12
  • WEB服务器云端webdav服务器

    云端webdav服务器

    云端WebDAV服务器是一种在云端环境下提供WebDAV(Web Distributed Authoring and Versioning)协议服务的技术。WebDAV是一种HTTP扩展协议,它允许用户通过Internet访问分布...

    未知972023-05-25
  • WEB服务器phpstudy默认不支持64位php的解决方法

    phpstudy默认不支持64位php的解决方法

    下面小编就为大家带来一篇phpstudy默认不支持64位php的解决方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧 ...

    jingxian4702019-10-17
  • WEB服务器湖北web云服务器价格

    湖北web云服务器价格

    湖北web 云服务器 价格 近年来,随着互联网技术的快速发展,云计算技术已经被广泛应用于各行各业,对于企业来说,云计算技术已经成为提升企业信息化...

    未知1612023-06-07