如何配置Apache';s站点已启用配置?

如何配置Apache';s站点已启用配置?,apache,ubuntu,Apache,Ubuntu,我有一个UBUNTU/APACHE框,当我尝试使用主机名访问web服务器时,它会将我带到DocumentRoot(即/var/www),并显示那里的所有文件/文件夹(如预期的那样) 在我的/var/www中,我有几个文件夹,如/var/www/devel和var/www/live,如何更新配置,以便在通过服务器的主机名访问服务器时[http://servername]默认情况下,它进入DocumentRoot的子文件夹 我试图将DocumnetRoot更改为指向/var/www/live,当我点

我有一个UBUNTU/APACHE框,当我尝试使用主机名访问web服务器时,它会将我带到DocumentRoot(即/var/www),并显示那里的所有文件/文件夹(如预期的那样)

在我的/var/www中,我有几个文件夹,如/var/www/devel和var/www/live,如何更新配置,以便在通过服务器的主机名访问服务器时[http://servername]默认情况下,它进入DocumentRoot的子文件夹

我试图将DocumnetRoot更改为指向/var/www/live,当我点击主机名时,它会将我发送到正确的路径,但是我无法访问/var/www/dev(通过转到[http://servername/dev])

这很可能是因为现在/dev在DocumentRoot之外,我如何调整配置以便仍然可以访问[http://servername/dev]当[http://servername]决心活下去

这是我的配置

    DocumentRoot /var/www

    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>

    <Directory /var/www>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    <Directory "/var/www/dev">
            AuthName "NTLM Authentication"
            NTLMAuth on
            NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
            NTLMBasicAuthoritative on
            AuthType NTLM
            require valid-user
    </Directory>

    <Directory "/var/www/live">
            AuthName "NTLM Authentication"
            NTLMAuth on
            NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
            NTLMBasicAuthoritative on
            AuthType NTLM
            require valid-user
    </Directory>
DocumentRoot/var/www
选项如下符号链接
允许超越所有
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融
AuthName“NTLM身份验证”
NTLMAuth on
NTLMAuthHelper“/usr/bin/ntlm_auth--helper协议=squid-2.5-ntlmssp”
NTLMBASIC授权
授权类型NTLM
需要有效用户
AuthName“NTLM身份验证”
NTLMAuth on
NTLMAuthHelper“/usr/bin/ntlm_auth--helper协议=squid-2.5-ntlmssp”
NTLMBASIC授权
授权类型NTLM
需要有效用户

如果需要描述的行为,则不需要更改DocumentRoot。您需要做的是使用mod_rewrite之类的东西重定向,以“重写”指向所需目录的url。这样,您仍然可以保留DocumentRoot。它看起来像这样:

RewriteEngine on
RewriteRule ^/$ /live/ [R]
查看此链接了解更多想法。