华域联盟 Linux Apache为mysql以及自己的项目设置虚拟路径

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 [email protected]

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 [email protected]

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 [email protected]

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为mysql以及自己的项目设置虚拟路径

转载请保留出处和原文链接:https://www.cnhackhy.com/43688.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部