0

我在 ubuntu 12.10 上使用 Lamp 服务器。将 apache2 默认根目录更改为“/home/erkan/www”后,出现 403 错误。

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/erkan/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /home/erkan/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

现在我无法访问 127.0.0.1 上的网页,因为“您无权访问此服务器上的 /”。

这是文件权限列表

drwxrwxr-x 5 erkan erkan 4096 Apr 17 02:19 build
drwxr-xr-x 3 erkan erkan 4096 Jun 10 01:15 Desktop
drwxr-xr-x 4 erkan erkan 4096 Jun 10 01:03 Documents
drwxr-xr-x 5 erkan erkan 4096 Jun 10 01:02 Downloads
-rw-r--r-- 1 erkan erkan 8445 Mar 30 02:05 examples.desktop
drwxr-xr-x 2 erkan erkan 4096 Apr 18 23:30 fontconfig
drwxr-xr-x 2 erkan erkan 4096 Mar 30 02:11 Music
drwxr-xr-x 3 erkan erkan 4096 Apr  3 02:48 Pictures
drwxrwxr-x 4 erkan erkan 4096 Apr 22 22:59 Projects
drwxr-xr-x 2 erkan erkan 4096 Mar 30 02:11 Public
drwxr-xr-x 2 erkan erkan 4096 Mar 30 02:11 Templates
drwxrwxr-x 3 erkan erkan 4096 Mar 30 00:18 Tools
drwxrwxr-x 2 erkan erkan 4096 Mar 30 00:12 Ubuntu One
drwxr-xr-x 2 erkan erkan 4096 Mar 30 02:11 Videos
drwxrwxrwx 3 erkan erkan 4096 Jun 10 01:35 www
4

1 回答 1

0

您需要更改<Directory />to<Directory /home/erkan/www/>并重新加载 apache:sudo /etc/init.d/apache2 reload

有关更多信息,请参阅:https ://netbeans.org/kb/docs/php/configure-php-environment-ubuntu.html#createDocumentRootLocation

于 2013-06-09T23:59:57.277 回答