Apache alias虚拟目录设置问题
为情所困
为情所困 2017-05-16 17:00:12
[Linux讨论组]

apache 设置虚拟目录,进入到了index.html页面,但是无法访问到网页内容中引用了别的文件夹的内容,包括css,js,图片等文件;

apache版本:httpd-tools-2.2.15-47.el6.centos.4.i686

httpd -M :
...
actions_module (static)
alias_module (static)
rewrite_module (static)
...

httpd.conf:

    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
      Alias /zh "/data/wwwroot/zh"
      
                Options Indexes FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
      
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a  section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"




index.html




Miaos' Photos





  

网页访问结果:

能进入到虚拟目录中的index.html文件,但是里面的图片全都无法访问,js效果也没有。
目录设置的都是相对目录,同样的配置在另一台虚拟机中可以完美访问

求教各位熟悉apache的前辈,这是怎么回事!

为情所困
为情所困

全部回复(2)
某草草

你f12看一下那些图片,js引用的路径实际是什么

大家讲道理

重装apache可以解决;
原来的apache是用网上的一个LAMP,yum安装的,应该有点问题。。。。。。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号