web-dev-qa-db-ja.com

デフォルトのApache webrootは私が期待するものとは異なります。 / var / wwwではなく/ var / www / htmlのようです

Ubuntu 14.04.2にApacheの新規インストールがあります

/etc/Apache2/Apache2.confファイルには次が含まれます。

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

この設定では、webrootが/ var/www /の場合は意味がありますが、動作に基づいて(ブラウザからアクセスしようとすると)/ var/www/html /のように見えます

なぜhtmlサブフォルダーを使用するのですか?

1

/ etc/Apache2/sites-available /にあるファイル000-default.confは、/ var/www/html /フォルダーをwebrootとして定義します(これは、/ etc/Apache2/sites- enabled/folder):

<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 www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # 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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual Host. For example the
        # following line enables the CGI configuration for this Host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=Apache ts=4 sw=4 sts=4 sr noet
1