我在AWS上有一个服务器,它为许多网站服务。还安装了Webmin。
在Apache中,当我尝试创建一个网站时,比如ferrari.example.com,当我使用web浏览器请求它时,我会得到错误Forbidden. You don't have permission to access this resource.。
这不是文件权限问题,因为如果我使用不同的域名(指向同一个目录),它可以正常工作。
这不是Apache配置问题,因为如果我只更改域名(以及其他配置设置),它就能正常工作。
是的,我有一个正确的DNS条目,它指向ferrari.example.com指向我的服务器。
不,在Apache中没有其他站点与域名冲突。我在/etc/apache上做了一个D4,只找到了一个站点。
有其他人知道为什么这不管用吗?
DocumentRoot /var/www/ferrari.example.com
ServerName ferrari.example.com
AllowOverride All
Options None
Require all granted我想我没有安装SELinux。
日志级调试显示了以下错误:
[Thu Sep 19 19:13:00.740101 2019] [authz_core:debug] [pid 31107] mod_authz_core.c(809): [client 204.112.96.198:13742] AH01626: authorization result of Require all denied: denied, referer: http://ferrari.example.com/
[Thu Sep 19 19:13:00.740130 2019] [authz_core:debug] [pid 31107] mod_authz_core.c(809): [client 204.112.96.198:13742] AH01626: authorization result of : denied, referer: http://ferrari.example.com/
[Thu Sep 19 19:13:00.740139 2019] [authz_core:error] [pid 31107] [client 204.112.96.198:13742] AH01630: client denied by server configuration: /var/www/html/favicon.ico, referer: http://ferrari.example.com/发布于 2020-01-17 15:32:44
我也面临着同样的问题。
以下是我是如何解决它的
使用nano编辑器打开apache2.conf文件。
sudo nano /etc/apache2/apache2.conf用以下内容替换常规目录设置。
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Require all granted
AllowOverride None
Require all granted
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
#
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#确保/etc/apache2/sites-available目录中的虚拟主机配置文件是这样的。
# The ServerName directive sets the request scheme, hostname and port t$
# 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 example.com (put your domain name here)
ServerAdmin webmaster@localhost
DocumentRoot /home/username/myapp (put your app root directory here)
# 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
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet重新启动Apache2服务
sudo systemctl restart apache2就这样。
I希望这有助于
https://serverfault.com/questions/984889
复制相似问题