问答详情
源自:5-7 在Apache中配置虚拟主机

为什么我的设置之后,内容不能出来?

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName video.imooc.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/wwwroot/video/




        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
"video" 34L, 1363C          

提问者:ypqal1 2016-06-15 14:46

个回答

  • 爱豆人的马小跳
    2017-07-06 22:08:35

    好吧,这折腾了一下ubuntu 14.04 LTS + apache2 

    如果还是不行的,你要弄两个东西:

    1. 复制的是000-default.conf 文件,文件名要有.conf后缀,比如:bbs.conf , oa .conf , video.conf ,不然没用! 切记!!!之后在sites-enabled中创建软链接时,也要注意文件名+.conf后缀:

    如: 

    ls -s ../sites-available/bbs.conf bbs.conf 

    2. 我就问你,原配置文件你停用了没??

    修改虚拟主机文件后,禁用默认的虚拟主机配置(000.default.conf),然后启用新的虚拟主机配置,如下sudo a2dissite 000-default.conf && sudo a2ensite unixmen1.local.confsudo a2ensite unixmen2.local.conf


  • 残无殇
    2016-06-16 13:58:03

    你设置的路径是/var/wwwroot/video/,你的文件夹是不是这个,你实际的文件夹名称会不会是/wwwroot/video/?要不你再确定一下吧