When I start Apache by editing httpd.conf on macOS, I get a Forbidden response.

Asked 2 years ago, Updated 2 years ago, 51 views

First of all, our system environment.
macOS Sierra Apache: 2.4.25(Unix)
mysql:stable 5.7.19

Launch the server and

http://localhost/

You can also access the

Forbiden You don't have permission to access/on this server.

The error log can be found in

Cannot save directory/users/Username/Sites/: 
No matching DirectoryIndex(index.php, index.html, index.html, index.php) found,     
and server-generated directory index forbidden by Options directive

httpd.conf (Changes)

#LoadModule userdir_module libexec/apache2/mod_userdir.so #CommentOut
# LoadModule alias_module libexec/apache2/mod_alias.so #CommentOut
# LoadModule rewrite_module libexec/apache2/mod_rewrite.so #Commentout
# LoadModule php5_module libexec/apache2/libphp5.so #CommentOut

DocumentRoot"/users/username/Sites/"
 <Directory"/users/username/Sites/">
#
# Possible values for the Options direct are "None", "All",
# or any combination of:
#   Indexes Included FollowSymlinksSymlinksifOwnerMatchExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# Doesn't give it to you.
#
# The Options direct is both compiled and imported.Please see
# # http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymlinks Multiviews
MultiviewsMatch Any

#
# AllowOverride controls what directives may be placed in.htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all graded

Include/private/etc/apache2/extra/httpd-userdir.conf #CommentOut

I also created the username .conf and

/apache2/users/username

<Directory"/Users/Username/Sites/">
AllowOverride All
Options Indexes MultiViews
Options + FollowSymlinks
Require all graded
</Directory>

It is included as .

Please tell me how to solve this problem because I am inexperienced.
Thank you for your cooperation.

macos apache

2022-09-30 14:13

2 Answers

You don't have permission to access/on this server.

does not directly refer to permissions on the file system.In some cases, this is a common message that occurs when Apache is stuck with access restrictions or permission restrictions.

In this case, the error message is

  • Index.php, index.html used in DirectoryIndex not found
  • List prohibited (no Options Indexes)

It says.Add Indexes to Options at httd.conf or create index.html or index.php.

--

It's a snake's foot, but

Include/private/etc/apache2/extra/httpd-userdir.conf #CommentOut

I don't know if I left a comment or not.If you commented out,

#Include/private/etc/apache2/extra/httpd-userdir.conf #Commentout

indicates the actual comment out, otherwise

Include/private/etc/apache2/extra/httpd-userdir.conf #Uncomment out

It would be better to make comments reflecting the actual situation.


2022-09-30 14:13

First of all, it would be good to verify the existence and permission of the directory with the following command:

ls-lah/users/yusuke3627/Sites/

*Also, the ls command seems to pass, but I think it would be better to specify /Users instead of /users.

Since there is no permission, why don't you check the designated user with the following commands and change the owner of the document route?

httpd-t-DDUMP_CONFIG2>/dev/null | grep "User"
chown-Rwww: www/Users/yusuke3627/Sites/


2022-09-30 14:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.