LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1288|回复: 11

各位兄弟,我用apache1.3设置虚拟主机,为啥不能显示图片阿

[复制链接]
发表于 2006-6-24 13:55:36 | 显示全部楼层 |阅读模式
用IP访问可以
http://202.118.176.33/heubbs
用刚刚设置的虚拟主机,不能显示图片
http://heubbs.com


各位兄弟能给点提示吗???谢谢啦
发表于 2006-6-24 14:09:19 | 显示全部楼层
把虚拟主机的设置部分发上来看看。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-24 14:11:41 | 显示全部楼层
<VirtualHost 202.118.176.33:80>
    ServerAdmin skybird@hrbeu.edu.cn
    DocumentRoot "/var/www"
    ServerName linux.hrbeu.edu.cn
</VirtualHost>

<VirtualHost 202.118.176.33:80>
    ServerAdmin hrbeu@126.com
    DocumentRoot "/var/www/heubbs"
    ServerName heubbs.com
</VirtualHost>

<VirtualHost 202.118.176.33:80>
    ServerAdmin hrbeu@126.com
    DocumentRoot "/var/www/heubbs"
    ServerName www.heubbs.com
</VirtualHost>

-----------------------
谢谢楼上的兄弟
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-24 14:13:29 | 显示全部楼层
完整的设置:

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them.
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
#
#Use name-based virtual hosting
NameVirtualHost 202.118.176.33:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
#<VirtualHost ip.address.of.host.some_domain.com>
#    ServerAdmin webmaster@host.some_domain.com
#    DocumentRoot /www/docs/host.some_domain.com
#    ServerName host.some_domain.com
#    ErrorLog logs/host.some_domain.com-error.log
#    CustomLog logs/host.some_domain.com-access.log common
#</VirtualHost>



<VirtualHost 202.118.176.33:80>
    ServerAdmin skybird@hrbeu.edu.cn
    DocumentRoot "/var/www"
    ServerName linux.hrbeu.edu.cn
</VirtualHost>

<VirtualHost 202.118.176.33:80>
    ServerAdmin hrbeu@126.com
    DocumentRoot "/var/www/heubbs"
    ServerName heubbs.com
</VirtualHost>

<VirtualHost 202.118.176.33:80>
    ServerAdmin hrbeu@126.com
    DocumentRoot "/var/www/heubbs"
    ServerName www.heubbs.com
</VirtualHost>


# Automatically added by the post-installation script
# as part of the transition to a config directory layout
# similar to apache2, and that will help users to migrate
# from apache to apache2 or revert back easily
Include /etc/apache/conf.d
回复 支持 反对

使用道具 举报

发表于 2006-6-24 14:19:50 | 显示全部楼层
改成这样
<VirtualHost 202.118.176.33:80>
ServerAdmin hrbeu@126.com
DocumentRoot "/var/www/heubbs"
ServerName www.heubbs.com
ServerAlias heubbs.com  *.heubbs.com
</VirtualHost>

如果不行,把修改后的移到
<VirtualHost 202.118.176.33:80>
ServerAdmin skybird@hrbeu.edu.cn
DocumentRoot "/var/www"
ServerName linux.hrbeu.edu.cn
</VirtualHost>
的前面。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-24 14:44:24 | 显示全部楼层
还是不行啊

试了第一种,没变化
第二种,所有虚拟主机都变成heubbs.com了

图片无法显示,是路径问题吗?或是权限设置?
这点还是想不通
回复 支持 反对

使用道具 举报

发表于 2006-6-24 14:47:08 | 显示全部楼层
你看一下Apache的出错日志,看它把路径映射到了哪里。按照Apache文档里的例子,所有的主机都必须设置ServerAlias,你试了第二种可以显示图片了吗?所有的主机都设置ServerAlias看看。你的第二个主机是多余了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-24 14:55:40 | 显示全部楼层
第二种也不能显示图片
但是通过IP可以。。。
http://202.118.176.33/heubbs
可能就是路径设置问题吧
路径在哪设置的?
麻烦兄弟,我对这个不太懂,以前没弄过虚拟主机
回复 支持 反对

使用道具 举报

发表于 2006-6-24 14:59:48 | 显示全部楼层
把原来的虚拟主机设置全都注释掉,使用下面的设置:

<VirtualHost 202.118.176.33:80>
ServerAdmin hrbeu@126.com
DocumentRoot "/var/www/heubbs"
ServerName www.heubbs.com
ServerAlias heubbs.com *.heubbs.com
</VirtualHost>

<VirtualHost 202.118.176.33:80>
ServerAdmin skybird@hrbeu.edu.cn
DocumentRoot "/var/www"
ServerName linux.hrbeu.edu.cn
</VirtualHost>

看一下Apache的日志error.log
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-24 15:28:44 | 显示全部楼层
是路径问题啊,虚拟主机还是原来的路径。。。晕,这个应该怎么改

[Sun Jun 18 06:25:06 2006] [notice] Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-16 configured -- resuming normal operations
[Sun Jun 18 06:25:06 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Sun Jun 18 06:25:10 2006] [error] [client 221.212.124.144] File does not exist: /var/www/logo.gif
[Sun Jun 18 06:25:11 2006] [error] [client 202.160.179.144] File does not exist: /var/www/robots.txt
[Sun Jun 18 06:25:37 2006] [error] [client 202.160.179.144] File does not exist: /var/www/robots.txt
[Sun Jun 18 06:25:53 2006] [error] [client 202.160.179.144] File does not exist: /var/www/robots.txt
[Sun Jun 18 06:25:57 2006] [error] [client 210.47.10.80] File does not exist: /var/www/logo.gif
[Sun Jun 18 06:26:01 2006] [error] [client 210.47.10.80] File does not exist: /var/www/logo.gif
[Sun Jun 18 06:26:11 2006] [error] [client 202.160.179.144] File does not exist: /var/www/robots.txt
[Sun Jun 18 06:26:32 2006] [error] [client 202.160.179.144] File does not exist: /var/www/robots.txt
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表