我正在获取当前日志:
[Mon Nov 02 11:31:37.831384 2015] [core:error] [pid 15509] (13)Permission denied: [client 127.0.0.1:55073] AH00035: access to / denied (filesystem path '/home/sharkie/NetBeansProjects') because search permissions are missing on a component of the path
在浏览器上:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at gamefriend.local Port 80
添加到/etc/apache2/apache2.conf
<Directory /home/sharkie/NetBeansProjects/GameFriend/web/>
Require all granted
</Directory>
命令在提示符
上运行
find /home/sharkie/NetBeansProjects/ -type f -exec chmod 644 {} \;
find /home/sharkie/NetBeansProjects/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;
find /var/www/ -type d -exec chmod 755 {} \;
chmod +rwx /home/sharkie/NetBeansProjects/
chmod +rwx /home/sharkie/NetBeansProjects/GameFriend
chmod +rwx /home/sharkie/NetBeansProjects/GameFriend/web
我目前在apache2 / sites-enabled文件夹中的Gamefriend.conf文件
<VirtualHost *:80>
ServerName gamefriend.local
DocumentRoot /home/sharkie/NetBeansProjects/GameFriend/web
DirectoryIndex app.php
ErrorLog /var/log/apache2/gamefriend-error.log
CustomLog /var/log/apache2/gamefriend-access.log combined
<Directory "/home/sharkie/NetBeansProjects/GameFriend/web">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
通过以下命令查找.htaccess文件但未找到:
tree -if / | grep .htaccess
这里有文件夹权限:
drwxr-xr-x 3 sharkie sharkie 4096 Nov 2 09:58 NetBeansProjects
Inside NetBeansProjects
drwxr-xr-x 7 sharkie sharkie 4096 Nov 2 09:58 GameFriend
Inside GameFriend
drwxr-xr-x 6 sharkie sharkie 4096 Nov 2 09:58 app
drwxr-xr-x 2 sharkie sharkie 4096 Nov 2 09:58 bin
-rw-r--r-- 1 sharkie sharkie 2148 Nov 2 09:58 composer.json
-rw-r--r-- 1 sharkie sharkie 61966 Nov 2 09:58 composer.lock
-rw-r--r-- 1 sharkie sharkie 79 Nov 2 09:58 README.md
drwxr-xr-x 3 sharkie sharkie 4096 Nov 2 09:58 src
drwxr-xr-x 14 sharkie sharkie 4096 Nov 2 09:58 vendor
drwxr-xr-x 3 sharkie sharkie 4096 Oct 27 20:00 web
答案 0 :(得分:1)
即使我不知道它是否安全,也找到了解决方案。
chmod +x /
chmod +x /home/
chmod +x /home/sharkie/
任何评论都会因为让它搜索主页和用户文件夹而受到赞赏。