Pet*_*sen 42 ubuntu apache2 virtualhost http-status-code-403
我在桌面上运行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的/网站可用/ 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>
Run Code Online (Sandbox Code Playgroud)
我做到了 sudo a2dissite default && sudo a2ensite afflicto && sudo service apache2 restart
我创建了一个index.php
和index.html
在/home/afflicto/public_html/test/
访问时localhost/test
或localhost/test/index.html
等,我得到403 Forbidden错误.
我究竟做错了什么?提前致谢.
更新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
Run Code Online (Sandbox Code Playgroud)
Pet*_*ter 105
我遇到了这个问题.但我不喜欢将我的主目录组更改为www-data的想法.可以通过修改virtualHost的配置文件来简单地解决此问题.只需配置Directory标记即可包含这些内容
<Directory "your directory here">
Order allow,deny
Allow from all
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)
这Require all granted
是我猜的一个新功能; 默认值为denied
.
有关详细信息,请参阅此页面:http://httpd.apache.org/docs/current/mod/core.html#directory
Pet*_*sen 20
结果我不仅要chmod /home/afflicto/public_html
而且还要有/home/afflicto/
目录.
奇怪的.
归档时间: |
|
查看次数: |
87947 次 |
最近记录: |