linux – AH01630:服务器配置Apache拒绝客户端

前端之家收集整理的这篇文章主要介绍了linux – AH01630:服务器配置Apache拒绝客户端前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试通过浏览器访问localhost时出现此错误.

403 Forbidden

我使用Ubuntu 14.04 LTS

这是我的配置文件

等/ apache2.conf

  1. # This is the main Apache server configuration file. It contains the
  2. # configuration directives that give the server its instructions.
  3. # See http://httpd.apache.org/docs/2.4/ for detailed information about
  4. # the directives and /usr/share/doc/apache2/README.Debian about Debian specific
  5. # hints.
  6. #
  7. #
  8. # Summary of how the Apache 2 configuration works in Debian:
  9. # The Apache 2 web server configuration in Debian is quite different to
  10. # upstream's suggested way to configure the web server. This is because Debian'sA
  11. # default Apache2 installation attempts to make adding and removing modules,# virtual hosts,and extra configuration directives as flexible as possible,in
  12. # order to make automating the changes and administering the server as easy as
  13. # possible.
  14.  
  15. # It is split into several files forming the configuration hierarchy outlined
  16. # below,all located in the /etc/apache2/ directory:
  17. #
  18. # /etc/apache2/
  19. # |-- apache2.conf
  20. # | `-- ports.conf
  21. # |-- mods-enabled
  22. # | |-- *.load
  23. # | `-- *.conf
  24. # |-- conf-enabled
  25. # | `-- *.conf
  26. # `-- sites-enabled
  27. # `-- *.conf
  28. #
  29. #
  30. # * apache2.conf is the main configuration file (this file). It puts the pieces
  31. # together by including all remaining configuration files when starting up the
  32. # web server.
  33. #
  34. # * ports.conf is always included from the main configuration file. It is
  35. # supposed to determine listening ports for incoming connections which can be
  36. # customized anytime.
  37. #
  38. # * Configuration files in the mods-enabled/,conf-enabled/ and sites-enabled/
  39. # directories contain particular configuration snippets which manage modules,# global configuration fragments,or virtual host configurations,# respectively.
  40. #
  41. # They are activated by symlinking available configuration files from their
  42. # respective *-available/ counterparts. These should be managed by using our
  43. # helpers a2enmod/a2dismod,a2ensite/a2dissite and a2enconf/a2disconf. See
  44. # their respective man pages for detailed information.
  45. #
  46. # * The binary is called apache2. Due to the use of environment variables,in
  47. # the default configuration,apache2 needs to be started/stopped with
  48. # /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
  49. # work with the default configuration.
  50.  
  51.  
  52. # Global configuration
  53. #
  54.  
  55. #
  56. # ServerRoot: The top of the directory tree under which the server's
  57. # configuration,error,and log files are kept.
  58. #
  59. # NOTE! If you intend to place this on an NFS (or otherwise network)
  60. # mounted filesystem then please read the Mutex documentation (available
  61. # at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
  62. # you will save yourself a lot of trouble.
  63. #
  64. # Do NOT add a slash at the end of the directory path.
  65. #
  66. #ServerRoot "/etc/apache2"
  67.  
  68. #
  69. # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
  70. #
  71. Mutex file:${APACHE_LOCK_DIR} default
  72.  
  73. #
  74. # PidFile: The file in which the server should record its process
  75. # identification number when it starts.
  76. # This needs to be set in /etc/apache2/envvars
  77. #
  78. PidFile ${APACHE_PID_FILE}
  79.  
  80. #
  81. # Timeout: The number of seconds before receives and sends time out.
  82. #
  83. Timeout 300
  84.  
  85. #
  86. # KeepAlive: Whether or not to allow persistent connections (more than
  87. # one request per connection). Set to "Off" to deactivate.
  88. #
  89. KeepAlive On
  90.  
  91. #
  92. # MaxKeepAliveRequests: The maximum number of requests to allow
  93. # during a persistent connection. Set to 0 to allow an unlimited amount.
  94. # We recommend you leave this number high,for maximum performance.
  95. #
  96. MaxKeepAliveRequests 100
  97.  
  98. #
  99. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  100. # same client on the same connection.
  101. #
  102. KeepAliveTimeout 5
  103.  
  104.  
  105. # These need to be set in /etc/apache2/envvars
  106. User ${APACHE_RUN_USER}
  107. Group ${APACHE_RUN_GROUP}
  108.  
  109. #
  110. # HostnameLookups: Log the names of clients or just their IP addresses
  111. # e.g.,www.apache.org (on) or 204.62.129.132 (off).
  112. # The default is off because it'd be overall better for the net if people
  113. # had to knowingly turn this feature on,since enabling it means that
  114. # each client request will result in AT LEAST one lookup request to the
  115. # nameserver.
  116. #
  117. HostnameLookups Off
  118.  
  119. # ErrorLog: The location of the error log file.
  120. # If you do not specify an ErrorLog directive within a <VirtualHost>
  121. # container,error messages relating to that virtual host will be
  122. # logged here. If you *do* define an error logfile for a <VirtualHost>
  123. # container,that host's errors will be logged there and not here.
  124. #
  125. ErrorLog ${APACHE_LOG_DIR}/error.log
  126.  
  127. #
  128. # LogLevel: Control the severity of messages logged to the error_log.
  129. # Available values: trace8,...,trace1,debug,info,notice,warn,# error,crit,alert,emerg.
  130. # It is also possible to configure the log level for particular modules,e.g.
  131. # "LogLevel info ssl:warn"
  132. #
  133. LogLevel warn
  134.  
  135. # Include module configuration:
  136. IncludeOptional mods-enabled/*.load
  137. IncludeOptional mods-enabled/*.conf
  138.  
  139. # Include list of ports to listen on
  140. Include ports.conf
  141.  
  142.  
  143. # Sets the default security model of the Apache2 HTTPD server. It does
  144. # not allow access to the root filesystem outside of /usr/share and /var/www.
  145. # The former is used by web applications packaged in Debian,# the latter may be used for local directories served by the web server. If
  146. # your system is serving content from a sub-directory in /srv you must allow
  147. # access here,or in any related virtual host.
  148. <Directory /path/to/my/sites>
  149. Options Indexes FollowSymLinks
  150. AllowOverride None
  151. Require all granted
  152. </Directory>
  153.  
  154. <Directory /usr/share>
  155. AllowOverride None
  156. Require all granted
  157. </Directory>
  158.  
  159. <Directory /var/www/>
  160. Options Indexes FollowSymLinks
  161. AllowOverride None
  162. Require all granted
  163. </Directory>
  164.  
  165. #<Directory /srv/>
  166. # Options Indexes FollowSymLinks
  167. # AllowOverride None
  168. # Require all granted
  169. #</Directory>
  170.  
  171.  
  172.  
  173.  
  174. # AccessFileName: The name of the file to look for in each directory
  175. # for additional configuration directives. See also the AllowOverride
  176. # directive.
  177. #
  178. AccessFileName .htaccess
  179.  
  180. #
  181. # The following lines prevent .htaccess and .htpasswd files from being
  182. # viewed by Web clients.
  183. #
  184. <FilesMatch "^\.ht">
  185. Require all granted
  186. </FilesMatch>
  187.  
  188.  
  189. #
  190. # The following directives define some format nicknames for use with
  191. # a CustomLog directive.
  192. #
  193. # These deviate from the Common Log Format definitions in that they use %O
  194. # (the actual bytes sent including headers) instead of %b (the size of the
  195. # requested file),because the latter makes it impossible to detect partial
  196. # requests.
  197. #
  198. # Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
  199. # Use mod_remoteip instead.
  200. #
  201. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
  202. LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
  203. LogFormat "%h %l %u %t \"%r\" %>s %O" common
  204. LogFormat "%{Referer}i -> %U" referer
  205. LogFormat "%{User-agent}i" agent
  206.  
  207. # Include of directories ignores editors' and dpkg's backup files,# see README.Debian for details.
  208.  
  209. # Include generic snippets of statements
  210. IncludeOptional conf-enabled/*.conf
  211.  
  212. # Include the virtual host configurations:
  213. IncludeOptional sites-enabled/*.conf
  214.  
  215. # vim: Syntax=apache ts=4 sw=4 sts=4 sr noet

Apache日志:

  1. [Wed Jun 17 18:18:38.560856 2015] [authz_core:error] [pid 8872] [client 192.168.1.XX:XXXXX] AH01630: client denied by server configuration: /var/www/html/prestashop

我在论坛上关注的配置出错了

/etc/apache2/sites-enabled/prestashop.config:

  1. <VirtualHost *:80>
  2. # The ServerName directive sets the request scheme,hostname and port that
  3. # the server uses to identify itself. This is used when creating
  4. # redirection URLs. In the context of virtual hosts,the ServerName
  5. # specifies what hostname must appear in the request's Host: header to
  6. # match this virtual host. For the default virtual host (this file) this
  7. # value is not decisive as it is used as a last resort host regardless.
  8. # However,you must set it for any further virtual host explicitly.
  9. #ServerName www.example.com
  10.  
  11. ServerAdmin webmaster@localhost
  12. DocumentRoot /var/www/html/prestashop
  13.  
  14. # Available loglevels: trace8,emerg.
  15. # It is also possible to configure the loglevel for particular
  16. # modules,e.g.
  17. #LogLevel info ssl:warn
  18.  
  19. ErrorLog ${APACHE_LOG_DIR}/error.log
  20. CustomLog ${APACHE_LOG_DIR}/access.log combined
  21.  
  22. <Directory "/var/www/prestashop">
  23. Options All
  24. AllowOverride All
  25. Require all granted
  26. </Directory>
  27.  
  28.  
  29. # For most configuration files from conf-available/,which are
  30. # enabled or disabled at a global level,it is possible to
  31. # include a line for only one particular virtual host. For example the
  32. # following line enables the CGI configuration for this host only
  33. # after it has been globally disabled with "a2disconf".
  34. #Include conf-available/serve-cgi-bin.conf
  35. </VirtualHost>
  36.  
  37. # vim: Syntax=apache ts=4 sw=4 sts=4 sr noet

我已添加到apache并且我更新了服务并且总是出现同样的错误我想知道为什么它不起作用也许我想chmod这个网站可以在任何媒体类型本地访问请你的帮助和晚上好

解决方法

Apache 2.4附带了一些安全增强功能,试图让黑客更难以在受感染的系统上隐藏文件.此行为的解释更多:
http://httpd.apache.org/docs/2.4/upgrading.html#access

一个快速简单的解决方法是将目录规则添加到主apache配置文件(默认情况下在Ubuntu上为/etc/apache2/apache2.conf):

  1. <Directory /path/to/my/sites>
  2. Options Indexes FollowSymLinks
  3. AllowOverride None
  4. Require all granted
  5. </Directory>

猜你在找的Linux相关文章