質問: chmodおよびchgrpの後で、パスのコンポーネントに検索権限がないため、権限が拒否されました [core:error] [pid 5132](13)permission denied:[client 123.123.123.123:50398] ah00035:access to/denied(filesystem path '/var/www/mysite.com')for search permissions are missing on aパスのコンポーネント wwwフォルダのグループオーナーを最近変更しました。このグループには、いくつかのユーザーアカウントadminsとrootを含むapacheというグループがあります。また、chmodを使用してwwwを774に変更しました。それ以来、2つのドメインでforbidden you don't have permission to access / on this server.を取得しています。/var/www/mysite.comは禁止されています/var/www/mysite2.comは禁止されています/ var/www/htmlは問題なく動作します。# serverroot: the top of the directory tree under which the server's # configuration, error, and log files are kept. # # do not add a slash at the end of the directory path. if you point # serverroot at a non-local disk, be sure to specify a local disk on the # mutex directive, if file-based mutexes are used. if you wish to share the # same serverroot for multiple httpd daemons, you will need to change at # least pidfile. # serverroot "/etc/httpd" # # listen: allows you to bind apache to specific ip addresses and/or # ports, instead of the default. see also the <virtualhost> # directive. # # change this to listen on specific ip addresses as shown below to # prevent apache from glomming onto all bound ip addresses. # #listen 12.34.56.78:80 listen 80 # # dynamic shared object (dso) support # # to be able to use the functionality of a module which was built as a dso you # have to place corresponding `loadmodule' lines at this location so the # directives contained in it are actually available _before_ they are used. # statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # example: # loadmodule foo_module modules/mod_foo.so # include conf.modules.d/*.conf # # if you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # user/group: the name (or #number) of the user/group to run httpd as. # it is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # user apache group apache # 'main' server configuration # # the directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a # <virtualhost> definition. these values also provide defaults for # any <virtualhost> containers you may define later in the file. # # all of these directives may appear inside <virtualhost> containers, # in which case these default settings will be overridden for the # virtual host being defined. # # # serveradmin: your address, where problems with the server should be # e-mailed. this address appears on some server-generated pages, such # as error documents. e.g. admin@your-domain.com # serveradmin root@localhost # # servername gives the name and port that the server uses to identify itself. # this can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # if your host doesn't have a registered dns name, enter its ip address here. # #servername www.example.com:80 # # deny access to the entirety of your server's filesystem. you must # explicitly permit access to web content directories in other # <directory> blocks below. # <directory /> allowoverride none require all denied options indexes followsymlinks includes execcgi </directory> # # note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # documentroot: the directory out of which you will serve your # documents. by default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # documentroot "/var/www/html" # # relax access to content within /var/www. # <directory "/var/www"> allowoverride none # allow open access: require all granted </directory> # further relax access to the default document root: <directory "/var/www/html"> # # possible values for the options directive are "none", "all", # or any combination of: # indexes includes followsymlinks symlinksifownermatch execcgi multiviews # # note that "multiviews" must be named *explicitly* --- "options all" # doesn't give it to you. # # the options directive is both complicated and important. please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # options indexes followsymlinks # # allowoverride controls what directives may be placed in .htaccess files. # it can be "all", "none", or any combination of the keywords: # options fileinfo authconfig limit # allowoverride none # # controls who can get stuff from this server. # require all granted </directory> # # directoryindex: sets the file that apache will serve if a directory # is requested. # <ifmodule dir_module> directoryindex index.html </ifmodule> # # the following lines prevent .htaccess and .htpasswd files from being # viewed by web clients. # <files ".ht*"> require all denied </files> # # errorlog: the location of the error log file. # if you do not specify an errorlog directive within a <virtualhost> # container, error messages relating to that virtual host will be # logged here. if you *do* define an error logfile for a <virtualhost> # container, that host's errors will be logged there and not here. # errorlog "logs/error_log" # # loglevel: control the number of messages logged to the error_log. # possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # loglevel warn <ifmodule log_config_module> # # the following directives define some format nicknames for use with # a customlog directive (see below). # logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\"" combined logformat "%h %l %u %t \"%r\" %>s %b" common <ifmodule logio_module> # you need to enable mod_logio.c to use %i and %o logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\" %i %o" combinedio </ifmodule> # # the location and format of the access logfile (common logfile format). # if you do not define any access logfiles within a <virtualhost> # container, they will be logged here. contrariwise, if you *do* # define per-<virtualhost> access logfiles, transactions will be # logged therein and *not* in this file. # #customlog "logs/access_log" common # # if you prefer a logfile with access, agent, and referer information # (combined logfile format) you can use the following directive. # customlog "logs/access_log" combined </ifmodule> <ifmodule alias_module> # # redirect: allows you to tell clients about documents that used to # exist in your server's namespace, but do not anymore. the client # will make a new request for the document at its new location. # example: # redirect permanent /foo http://www.example.com/bar # # alias: maps web paths into filesystem paths and is used to # access content that does not live under the documentroot. # example: # alias /webpath /full/filesystem/path # # if you include a trailing / on /webpath then the server will # require it to be present in the url. you will also likely # need to provide a <directory> section to allow access to # the filesystem path. # # scriptalias: this controls which directories contain server scripts. # scriptaliases are essentially the same as aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the # client. the same rules about trailing "/" apply to scriptalias # directives as to alias. # scriptalias /cgi-bin/ "/var/www/cgi-bin/" </ifmodule> # # "/var/www/cgi-bin" should be changed to whatever your scriptaliased # cgi directory exists, if you have that configured. # <directory "/var/www/cgi-bin"> allowoverride none options none require all granted </directory> <ifmodule mime_module> # # typesconfig points to the file containing the list of mappings from # filename extension to mime-type. # typesconfig /etc/mime.types # # addtype allows you to add to or override the mime configuration # file specified in typesconfig for specific file types. # #addtype application/x-gzip .tgz # # addencoding allows you to have certain browsers uncompress # information on the fly. note: not all browsers support this. # #addencoding x-compress .z #addencoding x-gzip .gz .tgz # # if the addencoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # addtype application/x-compress .z addtype application/x-gzip .gz .tgz # # addhandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. these can be either built into the server # or added with the action directive (see below) # # to use cgi scripts outside of scriptaliased directories: # (you will also need to add "execcgi" to the "options" directive.) # #addhandler cgi-script .cgi # for type maps (negotiated resources): #addhandler type-map var # # filters allow you to process content before it is sent to the client. # # to parse .shtml files for server-side includes (ssi): # (you will also need to add "includes" to the "options" directive.) # addtype text/html .shtml addoutputfilter includes .shtml </ifmodule> # # specify a default charset for all content served; this enables # interpretation of all content as utf-8 by default. to use the # default browser choice (iso-8859-1), or to allow the meta tags # in html content to override this choice, comment out this # directive: # adddefaultcharset utf-8 <ifmodule mime_magic_module> # # the mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type. the mimemagicfile # directive tells the module where the hint definitions are located. # mimemagicfile conf/magic </ifmodule> # # customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # some examples: #errordocument 500 "the server made a boo boo." #errordocument 404 /missing.html #errordocument 404 "/cgi-bin/missing_handler.pl" #errordocument 402 http://www.example.com/subscription_info.html # # # enablemmap and enablesendfile: on systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files. this usually improves server performance, but must # be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # defaults if commented: enablemmap on, enablesendfile off # #enablemmap off enablesendfile on # supplemental configuration # # load config files in the "/etc/httpd/conf.d" directory, if any. includeoptional conf.d/*.conf loadmodule rewrite_module modules/mod_rewrite.so loadmodule log_config_module modules/mod_log_config.so <virtualhost *:80> servername www.mysite.com documentroot /var/www/mysite.com </virtualhost> <virtualhost *:80> servername www.mysite2.com documentroot /var/www/mysite2.com </virtualhost>
回答: 上記の方法を試しても問題が解決しない場合は、パス内のどのディレクトリにも、apacheアクセスを妨げるaclが設定されていないことを確認してください。以下を使用できます。getfacl <directoryname> aclを使用して設定された可能性のあるディレクトリの権限を取得します。次のように、基本的にユーザーにはすべての権限があり、グループには読み取りと実行(または検索)が行われているが書き込みは行われていないと表示されます。# file: <directoryname> # owner: username # group: username user::rwx user:1000:rwx group::--- group:username:r-x mask::rwx other::rwx apacheまたはグループにaclの使用へのアクセスを許可するには、以下を使用します。setfacl -m g:<groupname>:rx <directoryname> 親ディレクトリが同じであることを確認してください。 -rスイッチを使用して、最上位ディレクトリで再帰的に変更を行うことができます。私はこれと同じapacheアクセス許可の問題に遭遇し、sambaをしばらく使用していたときにディレクトリにaclを設定したことを思い出す前に、chmodとchownが効果がない理由を理解しようと頭をぶつけていました。