【发布时间】:2013-07-12 06:19:52
【问题描述】:
我在桌面上运行 ubuntu 13.04 64bit,我安装了 Apache2、MySQL 和 PHP 等。
我想让我的网络根在/home/afflicto/public_html 而不是/var/www。
所以我跟着这个指南走:
http://www.maketecheasier.com/install-and-configure-apache-in-ubuntu/2011/03/09
(我从“配置不同的站点”开始做所有事情)因为我更喜欢这个解决方案。
这是我所做的:
已安装 Apache2、MySQL 等。
将/etc/apache2/sites-avaliable/default 复制到/etc/apache2/sites-available/afflicto。然后编辑它,它现在看起来如下:
/etc/apache2/sites-available/afflicto
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/afflicto/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/afflicto/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
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
</VirtualHost>
我做了sudo a2dissite default && sudo a2ensite afflicto && sudo service apache2 restart
我在/home/afflicto/public_html/test/ 中创建了index.php 和index.html
访问localhost/test 或localhost/test/index.html 等时,出现403 禁止错误。
我做错了什么?提前致谢。
更新 1
我已将 public_html 目录的所有者设置为 www-data。
还有sudo chmod -R +x public_html && sudo chmod -R 777 public_html
还是一样的 403 错误。
这是 apache 错误日志的输出:
[Sun Jul 14 06:10:32 2013] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
[Sun Jul 14 06:10:32 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /favicon.ico denied
【问题讨论】:
标签: ubuntu apache2 virtualhost http-status-code-403