我有 Ubuntu Server 14.04.4 LTS。我的服务器上有一个虚拟主机。
我的.conf 文件:-
<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 [email protected]
ServerName 10.0.0.121
ServerAlias 10.0.0.121
DocumentRoot /files/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
但是当我输入 10.0.0.121 时它显示这。我不知道这是什么原因造成的。
我的 Apache 错误日志:-
[Fri Jul 01 15:13:05.160046 2016] [mpm_event:notice] [pid 2262:tid 3074648704] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations<br>
[Fri Jul 01 15:13:05.160478 2016] [core:notice] [pid 2262:tid 3074648704] AH00094: Command line: '/usr/sbin/apache2'<br>
[Fri Jul 01 15:23:18.475415 2016] [mpm_event:notice] [pid 2262:tid 3074648704] AH00491: caught SIGTERM, shutting down<br>
[Fri Jul 01 15:23:19.650003 2016] [mpm_event:notice] [pid 2559:tid 3075447424] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations<br>
[Fri Jul 01 15:23:19.650467 2016] [core:notice] [pid 2559:tid 3075447424] AH00094: Command line: '/usr/sbin/apache2'<br>
[Fri Jul 01 15:23:35.266006 2016] [authz_core:error] [pid 2562:tid 2954832704] [client 10.0.0.7:50516] AH01630: client denied by server configuration: /files/html/<br>
[Fri Jul 01 16:10:04.823455 2016] [authz_core:error] [pid 2562:tid 2938047296] [client 10.0.0.7:50674] AH01630: client denied by server configuration: /files/html/<br>
[Fri Jul 01 17:04:51.186287 2016] [authz_core:error] [pid 2562:tid 2929654592] [client 10.0.0.7:51929] AH01630: client denied by server configuration: /files/html/<br>
[Fri Jul 01 17:04:51.480669 2016] [authz_core:error] [pid 2562:tid 3021974336] [client 10.0.0.7:51929] AH01630: client denied by server configuration: /files/html/favicon.ico, referer: http://10.0.0.121/<br>
[Fri Jul 01 17:16:31.446780 2016] [mpm_event:notice] [pid 2559:tid 3075447424] AH00491: caught SIGTERM, shutting down<br>
[Fri Jul 01 17:16:32.617721 2016] [mpm_event:notice] [pid 3151:tid 3074488960] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations<br>
[Fri Jul 01 17:16:32.618108 2016] [core:notice] [pid 3151:tid 3074488960] AH00094: Command line: '/usr/sbin/apache2'<br>
[Fri Jul 01 17:16:43.780175 2016] [authz_core:error] [pid 3153:tid 3062889280] [client 10.0.0.7:52182] AH01630: client denied by server configuration: /files/html/<br>
[Fri Jul 01 17:16:44.084861 2016] [authz_core:error] [pid 3153:tid 3054496576] [client 10.0.0.7:52182] AH01630: client denied by server configuration: /files/html/favicon.ico, referer: http://10.0.0.121/
答案1
您必须允许访问/files/html
,例如
<Directory /files/html>
Require all granted
</Directory>
默认情况下,仅授予 访问权限/var/www
。