![Apache2 权限被拒绝 - 访问 / 被拒绝,因为路径的某个组件缺少搜索权限](https://linux22.com/image/1207176/Apache2%20%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D%20-%20%E8%AE%BF%E9%97%AE%20%2F%20%E8%A2%AB%E6%8B%92%E7%BB%9D%EF%BC%8C%E5%9B%A0%E4%B8%BA%E8%B7%AF%E5%BE%84%E7%9A%84%E6%9F%90%E4%B8%AA%E7%BB%84%E4%BB%B6%E7%BC%BA%E5%B0%91%E6%90%9C%E7%B4%A2%E6%9D%83%E9%99%90.png)
我在 Ubuntu 21.04 上使用 apache 并遇到权限问题
Server version: Apache/2.4.46 (Ubuntu)
Server built: 2021-06-17T17:09:41
sudo apache2ctl configtest 返回语法 OK
我的日志
[Thu Jul 22 14:08:49.553904 2021] [core:error] [pid 33685] (13)Permission denied: [client 127.0.0.1:41084] AH00035: access to / denied (filesystem path '/home/ivan/hosts') because search permissions are missing on a component of the path
[Thu Jul 22 14:08:49.609382 2021] [core:error] [pid 33685] (13)Permission denied: [client 127.0.0.1:41084] AH00035: access to /favicon.ico denied (filesystem path '/home/ivan/hosts') because search permissions are missing on a component of the path, referer: http://gpon-actual.local/
我的主人
<VirtualHost *:80>
ServerName gpon-actual.local
DocumentRoot /home/ivan/hosts/gpon-actual
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/gpon-actual-error.log
CustomLog ${APACHE_LOG_DIR}/gpon-actual-access.log combined
<Directory "/home/ivan/hosts/gpon-actual">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Allow from All
</Directory>
</VirtualHost>
我执行了不同的建议,但没有一个有帮助
chmod +x hosts
chmod +rx hosts
sudo chown -R $USER:$USER hosts
sudo chmod 777 -R hosts/
在我的 /etc/apache2/sites-available/site.conf 中我添加了
以前是
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
我刚刚又补充了一点:
<Directory /home/ivan/hosts/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
任何想法 ?
答案1
只需在 Ubuntu 22.04、Apache 2.4.52 上点击此按钮即可。修复很简单。我需要运行:
chmod +x /home/<USERNAME>
仅仅755
穿上/home/*/public_html
是不够的。