それで、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が応答しました。
- サイトを有効にし
a2ensite mydomain.com
てApacheを再ロードしました。 apachectl configtest
返品Syntax OK
ファイルerror.log
は000-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
。