Apache2 は site-enabled/*.conf を読みません。

Apache2 は site-enabled/*.conf を読みません。

それで、Ubuntu 14.04でApacheを使ってウェブサイトを設定してみました。

mydomain.com.confファイルを作成しましたsites-available/。それは次のとおりです。

mydomain.com.conf

<VirtualHost *:80>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    ServerAdmin [email protected]

    DocumentRoot /var/www/mydomain.com/public_html

    ErrorLog ${APACHE_LOG_DIR}/mydomain.com/error.log
    CustomLog ${APACHE_LOG_DIR}/mydomain.com/access.log combined
</VirtualHost>

000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    #DocumentRoot /var/www

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

何らかの理由でApacheはmydomain.com.confまったく読めないようです。デフォルトは常に000-default.conf

私のウェブサイトにアクセスしたときに403 Forbiddenが応答しました。

  1. サイトを有効にしa2ensite mydomain.comてApacheを再ロードしました。
  2. apachectl configtest返品Syntax OK

ファイルerror.log000-default.conf説明する

[Wed Sep 03 11:01:48.717652 2014] [autoindex:error] [pid 5869] [client 2.71.93.10:55718] AH01276: Cannot serve directory /var/www/: No matching DirectoryIndex (index.php,index.html,index.cgi,index.pl,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

そして、エラーログとアクセスログはmydomain.com空です。

私はapache2.conf一つを作りましたIncludeOptional sites-enabled/*.conf

のセキュリティモデルはapache2.conf次のとおりです。

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /var/www/>
        DirectoryIndex index.php, index.html
        AllowOverride None
        Require all granted
</Directory>

何が問題なの?

ベストアンサー1

あなたのウェブサイトはファイルがないか、彼が言及したファイルがない空ですDirectory Index

もう一つの可能​​性は権限です。あなたのサイトにあるファイルやディレクトリへのアクセス権がない可能性がありますapache's user

おすすめ記事