Where did the <Directory> directive go in Ubuntu 13.10 / Apache 2.4?

倾然丶 夕夏残阳落幕 提交于 2019-12-06 09:13:43

问题


Part of the old vhost files looked like this:

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

After upgrading to Ubuntu 13.10 / Apache 2.4, the vhost is ignored until you remove all the <Directory> configuration. Where did this go?


回答1:


You can use this configuration to handle multiple vhosts. These lines will go in apache2.conf file.

<VirtualHost *:80>
    ServerName mydomain.com

    DocumentRoot /var/www

    <Directory /var/www>
    Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName blog.mydomain.com
    ServerAlias *.mydomain.com
    DocumentRoot /var/www

    <Directory /var/www>
    Allow from all
    </Directory>

</VirtualHost>



回答2:


I had a similar problem with Linux Mint 16: I wanted the server location to be /home/user/www instead of /var/www, but couldn't see the Directory option to edit.

After some browsing, I found it in /etc/apache2/apache2.conf, around line 160.

Hope this helps you.




回答3:


You need to put this inside /etc/apache2/apache2.conf file




回答4:


As of now (2014-03-25), I retested the same configuration on a fully updated Ubuntu server, and the settings are no longer ignored, as long as the default directory options are specified for the default AKA fallback configuration too. E.g. 000-default.conf.



来源:https://stackoverflow.com/questions/20076102/where-did-the-directory-directive-go-in-ubuntu-13-10-apache-2-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!