tomcat开启虚拟主机localhost无法访问
来源:互联网 发布:大数据时代带来的问题 编辑:程序博客网 时间:2024/05/19 19:56
今天在集成环境下配虚拟主机,没想到虚拟主机开启后,localhost竟然无法访问了,解决办法是这样的:
1,用记事本打开apache目录下httpd文件(如:D:\wamp\bin\apache\apache2.2.8\conf),找到如下模块
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启wamp环境,无法打开localhost,需要在httpd- vhosts.conf配置一下。
2,用记事本打开httpd-vhosts文件,配置好localhost虚拟主机,参照httpd- vhosts文件中实例,修改成如下:
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "D:\wamp\www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
修改配置如下:
DocumentRoot 修改为本地wamp环境下的www目录(如:D:\wamp\www)
ServerName改为localhost
实例二,Apache配置 test.biuuu.com虚拟主机步骤
ServerAdmin test@biuuu.com
DocumentRoot E:\WebRoot\biuuu
ServerName test.biuuu.com
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
2,打开host文件(C:\WINDOWS\system32\drivers\etc\hosts),增加一行代码
127.0.0.1 test.biuuu.com
3,在浏览器中打开test.biuuu.com,发现如下错误403 Forbidden错误
Forbidden
You don't have permission to access / on this server.
分析:这主要是目录访问权限没有设置,需要设置对目录的访问权!
4,打开httpd文件,找到 如下语句
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
复制以上代码,并进行目录修改,把/替换为E:\WebRoot\biuuu,修改virtualHost代码如下
在浏览器中测试发现还是打不开,提示如上403 Forbidden错误,修改其中的Deny from all为allow from all
5,重启Apache,虚拟主机配置成 功!
注意事项
1,目录路径,如E:\WebRoot\biuuu
2,访问权限,如上Deny from all修改为allow from all
3,host文件,配置虚拟域名host指向
4,httpd文件,打开Include conf/extra/httpd-vhosts.conf模块
5,httpd-vhosts文件,配置虚拟主机
PS: D:\wamp\alias 也可以这样配置虚拟域名,和例二相同效果
ServerName blog.cc
ServerAlias blog.cc
DocumentRoot "D:\wamp\www\blog"
Options All FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.shtml index.aspx default.aspx
AllowOverride All
Order Deny,Allow
Allow from all
0 0
- tomcat开启虚拟主机localhost无法访问
- apache开启虚拟主机VHOST后 localhost无法访问,出现Forbidden 403
- eclipse启动tomcat, http://localhost:8080无法访问
- eclipse启动tomcat, http://localhost:8080无法访问
- eclipse启动tomcat, http://localhost:8080无法访问
- eclipse启动tomcat, http://localhost:8080无法访问
- tomcat可以启动,localhost:8080无法访问
- eclipse启动tomcat, http://localhost:8080无法访问
- Zend Framework开启虚拟主机后,进localhost出现forbidden提示
- localhost无法访问
- eclipse3.6_jee启动tomcat无法访问http://localhost:8080/
- 启动tomcat和myeclipse后,http://localhost:8080无法访问
- 在Eclipse中启动Tomcat后,http://localhost:8080/无法访问
- tomcat服务器输入localhost可以访问,ip无法访问解决办法
- 启动tomcat无法访问http://localhost:8080/的解决方案
- Tomcat启动后无法访问localhost的问题(LINUX)
- tomcat服务器输入localhost可以访问,ip无法访问解决办法
- 解决tomcat的http://localhost:8080/无法访问的情况
- 在注册表中实现管理员账号隐藏
- UVA - 10057 A mid-summer night's dream. 求中位数
- hdu 2199 二分
- You must restart adb and Eclipse 运行安卓程序出现的错误
- FZU 2103 排列组合
- tomcat开启虚拟主机localhost无法访问
- 关于android开发中涉及到的java知识:面向对象(六)
- android tips—启动Emergency call拨号盘
- GCC 编译使用动态链接库和静态链接库的方法
- java的深拷贝和浅拷贝
- 百度三道面试题 答案
- 使用JVM TI技术实现JVM监控
- 扩展欧几里德算法
- JavaMail实现邮件发送